Hi, Unfortunately, the current legend frame work does not support errorbars. And I don't think implementing this is easy. The thing is that errorbar creates multiple artists instead of single one.
The best workaround I can think of is to make the legend only with markers (and lines if you want), without errorbars. The return value of the errorbar command is a length 3 tuple, where the first element is a line2d instance for markers (and lines connecting markers). http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.errorbar Thus, something like below will work. legend([eb1[0],eb2[0]],['0.00001','0.0001'],numpoints=1) -JJ On Tue, Mar 31, 2009 at 11:02 AM, Wendell Cropper <wcrop...@ufl.edu> wrote: > > Hi, > > This script will not show the correct symbol in the legend for any errorbar > plots after the first one. The actual plots do show the correct symbols. I > am using the Enthought Python distribution 2.52001 for windows. I believe > that Matplotlib 0.91 is the included version. The code is as follows: > > > > from pylab import * > > x = array([0.01,0.02,0.05,0.1,0.2,0.4,0.75,0.9,0.95,0.975]) > > y1 = array([97.2136817,57.9900693,20.4359209,9.9532211,4.7415577 > ,2.286651,1.2720068,1.2496886,1.0442417,1.0214786]) > > y1e = array([21.24583421,13.52118541,0.64572956,0.101292487 > ,0.031985423,0.011020589,0.002536264,1.106704045,0.003217541,0.000809814]) > > y2 = array([95.5086963,52.6831257,20.5578082,9.9830355,4.7549975 > ,2.2913872,1.272631,1.0931035,1.0457724,1.0231651]) > > y2e = array([6.369373686,2.21322481,0.27464128,0.085151741,0.034399816 > ,0.009026401,0.002442033,0.001618337,0.001406813,0.001251265]) > > > eb1 = errorbar(x,y1,y1e, fmt = 'ro') > eb2 = errorbar(x,y2,y2e, fmt = 'gs') > > legend([eb1,eb2],['0.00001','0.0001'],numpoints=1) > > show() > > > Thanks for any suggestions. > > > > Wendell Cropper > Associate Professor, Biological Process Modeling > > University of Florida > School of Forest Resources and Conservation > 214 Newins-Ziegler > PO Box 110410 > Gainesville, FL 32611-0410 > > 352-846-0859 phone > 352-392-1707 fax > > wcrop...@ufl.edu > http://www.sfrc.ufl.edu/faculty/cropper/ > > > ------------------------------------------------------------------------------ > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > ------------------------------------------------------------------------------ _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users