Auto-legend patch

Attached is a patch to and 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.

Thanks John, also added to CVS. I think this could be extremely slow
for very large lines (100k points, for example) but I don't see that
as a real problem because auto placement is not the default for
legends (for precisely this reason).