New Pick Method with a simple example

The code just draw two lines a big one and a small one. The

    > classical pick method works prefectly if you do not do a
    > zoom to see the small line. But if you do it to see more
    > accurately this small line then it is impossible to pick the
    > big line unless you use PickBigLine. Basically, PickBigLine
    > evaluates the orthogonal distance from the selected point to
    > the line by calculating the intersection between the line
    > you want to select

Hi Paul,

OK, at least now I understand what the problem is. The current Axes
picker works on line vertices and not individual segments, so if you
zoom in on a segment and click on it you may not be near any of the
vertices. There is a similar problem with picking on polygons.
Ideally, you want to iterate over all the segments in the lines and
return the minimum distance to a segment (note there is a method
matplotlib.mlab.dist_point_to_segment which computes this distance).
For polygons, you would want to implement a test of insidedness.

I thought about this when implementing the pick method but was afraid
of the case when you have lots of segments; things could get really
slow if you have a line with 10000 points unless you wrote some
special purpose extension code.

I do not think a separate "pick big line method" is needed here.
Perhaps it makes more sense to add a flag to the pick method which
either does it the correct and potentially slow way (useverts=False or
something like that) or just picks on the vertices which is fast. For
dense lines, picking on the vertices works fine, but as you note this
condition isn't always true.

    > My interests are in ray tracing in geophysics. I am
    > generating a lot of lines (thousands of) and then I need
    > after zooming to identify trajectories connecting a source
    > and a receiver . For example when I am picking a line I need
    > to know to what beam it belongs and also to what ray it
    > coresponds (two integers for instance) which is something I
    > know when I am plotting the line. I don't know how to do it
    > with the label property. It is an axes property not a line2D
    > property. If you want I can give an example of the use of
    > the tag property I add.

An example would help.

Of course, in python, you can "tag" anything you want

    ax = subplot(111)
    ax.myinitials = 'JDH'

    line, = ax.plot([1,2,3])
    line.mydata = ('Hi', 23)

So it is questionable whether adding a "tag" attribute in particular
is helpful.