Here's a problem that's been driving me nuts, and I finally reduced it to a small self-contained script which can be found at http://gist.github.com/642538. The issue is that the pick_event does not always provide the correct index into the plotted data.
In case this script only bugs out on my machine, let me describe the problem. The callback should highlight whatever point is clicked. This happens correctly with no problems when clicking on 9 out of the 10 points in the figure. But clicking the indicated point on the left-hand side (x[9], y[9]) also causes the indicated point on the top right (x[6], y[6]) to be highlighted as well.
Frustratingly, it seems that the numbers themselves are important for reproducing this bug! Specifically, x[9]+=0.01 does not "fix" the bug . . . but x[9] += 0.1 makes the callback work correctly (i.e. only the clicked point is highlighted). I'm guessing this is some sort of tolerance issue somewhere, but I can't find it.
possibly-relevant info:
matplotlib 1.0.0
numpy 1.3.0
Ubuntu 10.04 64bit
thanks,
-ryan
Very strange. Careful analysis using your script shows that with a slightly smaller picker size (4), I was able to click on the troublesome point and have it return only the other point, while clicking in a slightly different spot gets me only the desired point. At one point, I set picker to 1, and I was able to get another point to occasionally cause problems (but not the original ones).
Very strange…
Ben Root
···
On Sat, Oct 23, 2010 at 1:41 PM, Ryan dale <dalerr@…3334…> wrote:
Here’s a problem that’s been driving me nuts, and I finally reduced it
to a small self-contained script which can be found at
http://gist.github.com/642538. The issue is that the pick_event does
not always provide the correct index into the plotted data.
In case this script only bugs out on my machine, let me describe the
problem. The callback should highlight whatever point is clicked. This
happens correctly with no problems when clicking on 9 out of the 10
points in the figure. But clicking the indicated point on the left-hand
side (x[9], y[9]) also causes the indicated point on the top right
(x[6], y[6]) to be highlighted as well.
Frustratingly, it seems that the numbers themselves are important for
reproducing this bug! Specifically, x[9]+=0.01 does not “fix” the bug .
. . but x[9] += 0.1 makes the callback work correctly (i.e. only the
clicked point is highlighted). I’m guessing this is some sort of
tolerance issue somewhere, but I can’t find it.
possibly-relevant info:
matplotlib 1.0.0
numpy 1.3.0
Ubuntu 10.04 64bit
thanks,
-ryan