Auto-legend patch

Attached is a patch to collections.py and legend.py to
make the auto-legend stuff smarter.

A couple of caveats.

The new code doesn’t makes as much use of C++ – there might be
performance issues for plots with large numbers of points, although I
haven’t encountered any.

I don’t think any of my tests include plots with LineCollections, so
there is a reasonable chance that code in _auto_legend_data has not
been exercised.

Other than that, it seems to do the trick.

John

legend.patch (4.57 KB)