Somehow, Figure.legend flattens the given handle list and this is the cause of the problem.
https://github.com/matplotlib/matplotlib/blob/master/lib/matplotlib/figure.py#L994 Does anyone know why this is necessary? I just filed a pull request to remove this. https://github.com/matplotlib/matplotlib/pull/534/files Meanwhile, you may do from matplotlib.legend import Legend l = Legend(fig, h, l, loc='lower right') fig.legends.append(l) This should be equivalent to fig.legend(h,l,loc='lower right'). Or, if you don't need axes legend, you may do legend(h,l,loc='lower right', bbox_to_anchor=[0,0,1,1], bbox_transform=fig.transFigure) Regards, -JJ On Tue, Oct 18, 2011 at 6:59 AM, Sterling Smith <smit...@fusion.gat.com> wrote: > Let me first say that I appreciate the work that the developers have put into > matplotlib. You're doing a great job. > > I have filed a bug report at > > https://github.com/matplotlib/matplotlib/issues/533 > > wherein I post the following > > Consider: > > from pylab import * > x = arange(0,1,.01) > y = x**2 > fig = figure(2) > ax = fig.add_subplot(111) > errorbar(x,y,yerr=x/10.,label='$x^2$') > errorbar(x,y**3,yerr=x/10.,label='$x^6$') > legend(loc='upper center') > h,l = ax.get_legend_handles_labels() > fig.legend(h,l,loc='lower right') > > > I am getting the right legend for the axes based legend, but the figure based > legend seems to be using the different parts of the errorbar for subsequent > handles, instead of using them as a group. From what I can tell, this has > appeared since the upgrade to version 1.1.0. > > I am running on Linux, python 2.7, gtkAgg backend. > > Thanks, > Sterling > > > ------------------------------------------------------------------------------ > All the data continuously generated in your IT infrastructure contains a > definitive record of customers, application performance, security > threats, fraudulent activity and more. Splunk takes this data and makes > sense of it. Business sense. IT sense. Common sense. > http://p.sf.net/sfu/splunk-d2d-oct > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > ------------------------------------------------------------------------------ All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity and more. Splunk takes this data and makes sense of it. Business sense. IT sense. Common sense. http://p.sf.net/sfu/splunk-d2d-oct _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users