ax.legend place legend outside plot

import numpy as np
import matplotlib.pyplot as plt

#Define arrays x, y1, y2, y3

fig = plt.figure()
ax = fig.add_axes((0.1,0.4,0.5,0.5))

ax.plot(x1,y1,linestyle='-',label='one')
ax.plot(x1,y2,linestyle='--',label='two')
ax.plot(x1,y3,linestyle='dotted',label='three')

ax.legend(bbox_to_anchor=(1.05,1.0),loc='best')

fig.savefig('Figure1.pdf')

Are there any code examples left?
Create a Free Account
Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Relative searches
ax.plot legend position how to place the legend outside the plot fig.legend locates legend outside graph plot legend location outside of plot ax legend outside of axis python scatter plot legend outside ax.legend matplotlib legend out of canvas matplotlib legend outside of plot how to write a legend outside the chart border python legend outside of plot matplotlib plt set legend outside plt place legend to right matplot lib legend belowe figure scatter legend out of the plot python plot legend location outside display legend outside plot matplotlib plt.legend outside of graph matplotlib legend location outside in left right top bottom how to put legend outside plot in matplotlib legend at the bottom matplotlib matplot move legend under plot legend left side matplotlib plt legend right outside how to put legend outside plot in python python plot legend outside graph plt legend location outside first row plot legend position out matplotlib legend location outside legend box outside of the box legend position outside plot matplotlib matplotlib legend position outside plt legend location outside put legend outside plot matplotlib matplotlib legend outside graph pandas plot legend outside graph pyplot set legend outside graph pyplot set legend outise matplotlib put legend outside plt legend outside Get legend out of the way pyplot move legend outside plot matplotlib plt move legend outside matplotlib outer legend matplotlib legend outside plot matplotlib legend placement outside put the legend above the figure notebook move legend outside matplotlib plt legend position outside ax.legend side legend outside of the plot python plt.legend outside pyplot legend outside matplotlib legend next to plot matplotlib position legend outside of plot matplotlib legend under plot plt legend under plot plt legend outsode set legend location off of plot matplotlib get legend outside of the plot python place legend outside plot matplotlib plt legend outside plot plot legend outside of plot python python figure label blocking graph python plot legend outside figure matplotlib legend out of figure matplotlib put legend next to plot how to get a large legend to not cover plot matplotlib matplotlib legend off the plot legend outside plot python matplotlib legend blocking plot legend outside plot matplotlib matplotlib label under axes move legend outside of plot matplotlib how to move legend out of the graph move tlegend to right python legend external python how to place a legend outside of plot axes how to place legend outside plot in python legend below right pyplot legend upper center outside pyplot legend outside upper one row pyplot legend outside upper pie plot how to put the legends outside how to put plt.pie() legend outside matplotlib legend outside how to have a matplot lib label outside the graph how to put the legend out of box in python python matplotlib place legend outside plot how to move legend outside the chart border python python legend outside plot ax.legend place legend outside plot
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source