The pick method because of the need to click on edges did

> not fullfill my needs. So I wrote a new method Called

> PickBigLine that does not required a mouse click close to

> the edge but close to the line you want to pick. This is

> particularly useful after zooming when the edges are

> sometimes out of the axis limits.

Hi Paul,

It is not clear to me what this method is for. It would help if you

posted an example where the current pick functionality failed and the

one you propose succeeds (perhaps you could define your function at

the top of the file for ease of use).

I have a couple of questions/comments about your code...

xt, yt = a.get_transform().numerix_x_y(xdata, ydata)

xt, yt = asarray(xt), asarray(yt)

There is no need to call asarray since numerix_x_y returns arrays.

xc, yc = xt[1]-xt[0], yt[1]-yt[0]

What is the point of this? Why do you only look at the points xt[1],

xt[0], yt[1], yt[0]? What if someone needs to click on another point

of the line?

if xc==0.0 and yc == 0.0: return 1000000.

D = xc*xc + yc*yc

D1 = -(xt[0]-xywin[0])*yc+(yt[0]-xywin[1])*xc

D2 = -(yt[0]-xywin[1])*yc-(xt[0]-xywin[0])*xc

What do D1 and D2 represent? I'm having trouble understanding why,

for example, you need to do (xt[0]-xywin[0])*yc

if D2/D>1.001 or D2/D<-0.001: return 1000000.

I think the 1000000.0 sentinel value should be renamed to some useful

constant name so it will be self documenting.

return abs(D1/D)

artists = self.lines

if not len(artists): return None

ds = [ (dist(a),a) for a in artists]

ds.sort()

return ds[0][1]

> I also needed to add a

> new property to Line2D called tag (similar to matlab) for

> sorting purposes. I wonder if you have thought of adding

> such a possibility to some objects for which it can be very

> useful.

Does the "label" property help here. Could you give a use case?

Thanks!

JDH