You have plotted three lines, but only provided legend labels for two of them. Try:
plt.legend(('Model length', 'Data length', 'Something else'), 'best', shadow=True, fancybox=True) Mike On 08/24/2010 06:33 AM, xyz wrote: > Hello, > the following script creates a legend for only two instead of three > datasets. > ----------- > from pylab import * > import matplotlib.pyplot as plt > > fig = plt.figure() > ax = fig.add_subplot(111) > > for i in [[2,2], [2,3], [4.2,3.5]]: > print i[0],i[1] > plt.plot(i[0],i[1],'o') > > ax.grid(True) > plt.legend(('Model length', 'Data length'), > 'best', shadow=True, fancybox=True) > > plt.show() > ----------------- > > What did I wrong. > > Thank you in advance. > > ------------------------------------------------------------------------------ > Sell apps to millions through the Intel(R) Atom(Tm) Developer Program > Be part of this innovative community and reach millions of netbook users > worldwide. Take advantage of special opportunities to increase revenue and > speed time-to-market. Join now, and jumpstart your future. > http://p.sf.net/sfu/intel-atom-d2d > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > -- Michael Droettboom Science Software Branch Space Telescope Science Institute Baltimore, Maryland, USA ------------------------------------------------------------------------------ Sell apps to millions through the Intel(R) Atom(Tm) Developer Program Be part of this innovative community and reach millions of netbook users worldwide. Take advantage of special opportunities to increase revenue and speed time-to-market. Join now, and jumpstart your future. http://p.sf.net/sfu/intel-atom-d2d _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users