legend breaks clf()

Norbert Nemec <Norbert.Nemec.list@...380...> writes:

Thanks for the hint. I just fixed the problem in SVN.

I thought I had fixed this in March... see
http://thread.gmane.org/gmane.comp.python.matplotlib.devel/2574

But that was the get_handles() in legend.py, while this one is in
axes.py. Probably the code was originally copied from one place to the
other, but the functions have diverged since: one copy has had this
bug fixed, the other has been extended to handle RegularPolyCollections.
Perhaps get_handles() should be promoted from internal function to a
method of Axes?

Also, if someone were interested in creating a unit test suite for
matplotlib, a good way to start could be to identify the intended
types of member variables (e.g. "list of Line2D objects"), run various
example scripts and check that the variables have the correct kind of
data.

···

--
Jouni K. Sepp�nen

Just checked in an even cleaner solution:

in _auto_legend_data, the internal routine get_handles() was overly complex:
first, it would merge lines, patches and linecollections into one list,
only to then
handle each kind separately. I simplified the code to avoid that issue,
so get_handle only
appears internally in Axes.legend()

Jouni K. Seppänen wrote:

···

Norbert Nemec <Norbert.Nemec.list@...380...> writes:

Thanks for the hint. I just fixed the problem in SVN.
    
I thought I had fixed this in March... see
http://thread.gmane.org/gmane.comp.python.matplotlib.devel/2574

But that was the get_handles() in legend.py, while this one is in
axes.py. Probably the code was originally copied from one place to the
other, but the functions have diverged since: one copy has had this
bug fixed, the other has been extended to handle RegularPolyCollections.
Perhaps get_handles() should be promoted from internal function to a
method of Axes?

Also, if someone were interested in creating a unit test suite for
matplotlib, a good way to start could be to identify the intended
types of member variables (e.g. "list of Line2D objects"), run various
example scripts and check that the variables have the correct kind of
data.