Jouni K. Seppänen wrote: > Nils Wagner <[EMAIL PROTECTED]> writes: > >> File "/usr/lib64/python2.4/site-packages/matplotlib/legend.py", line >> 357, in _auto_legend_data >> hlines = handle.get_lines() >> AttributeError: LineCollection instance has no attribute 'get_lines' > > It seems that get_lines() was removed from LineCollection in revision > 2052 by Eric Firing: > > | r2052 | efiring | 2006-02-11 22:56:42 +0200 (Sat, 11 Feb 2006) | 3 lines > | > | Add autolim kwarg to axes.add_collection; change get_verts() > | methods of collections accordingly. > > Perhaps Eric knows best how to fix _auto_legend_data()? >
It is fixed now in svn--to the extent that it ever was. I put back get_lines() in collections and fixed a related bug in legend, so the test script now works in the sense that it makes a legend. It puts in an unlabeled line, presumably corresponding to the line collection making up the error bars. Maybe legend provides a way to avoid this. I haven't looked. The larger problem, and the one that probably made me yank get_lines (without realizing the legend code was using it--my mistake--I do try to check for things like that) is that legend really wants to know the draw-time locations of all plot elements, and for collections (among other things) this cannot be determined in general. The collection get_lines and get_verts methods can give the right answer to legend only if the data and offset transforms are the same. Sometimes they are, sometimes they are not. LineCollection.get_lines() probably could be improved to do a better job than at present, but never a perfect one. This is an example of a more widespread problem that we have thought about and discussed (including some good ideas from John, of course), but solving it is not simple. For the time being, at least, we are stuck with some imperfections. In any case, thanks for bringing the legend/LineCollection bug to my attention. This is the sort of thing it is nice to get cleaned up before the next release, coming soon. Do you know of some other simple bugs like this we should look at ASAP? Eric ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users