On Mon, May 25, 2009 at 7:16 AM,  <jorgesmbox...@yahoo.es> wrote:
>
>
> Hi,
> I am trying to use matplotlib to visually explore some data. I started
> from the "event_handling example code: data_browser.py" example, but
> wanted to go a bit further. The idea is to have two plots and an image
> linked together. The first plot represents a measure calculated from
> an image region at different times of the day. Selecting one of this
> measures shows the corresponding image, and some other measure calculated
> from the individual pixels. Further on, selecting in the image or the
> second plot should highlight the corresponding point in the plot or pixel
> on the image, respectively (That is, the first plot is linked to the image,
> and the image and the second plot are linked together).
> My problem is that on the function being called upon and event, I always
> get events generated by the image, even when the moused was clicked on one of
> the other plots. The plots behave ok.
> The coded below is a simplified functional version (the measures here are
> trivial, and I haven't included the actions when the user selects the image or
> the second plot), which exhibits this behavior. What I see when executing this
> code is for example:
>

It looks like you found a pretty significant bug -- the Artist.pick
method forwards the event to all of it's children, whether or not the
pick event happened in the same Axes as the event being queried.  Not
only is this inefficient, it can create false positives when the two
axes share a similar coord system.  I just committed a fix to svn, to
make sure the artist axes instance is the same as the pick event
inaxes attribute before forwarding on the call.  artist.Artist.pick
now reads:

        # Pick children
        for a in self.get_children():
            # make sure the event happened in the same axes
            ax = getattr(a, 'axes', None)
            if mouseevent.inaxes==ax:
                a.pick(mouseevent)

This seems to fix the problem you identified -- give svn r7141 or
later a test drive if you have access

  http://matplotlib.sourceforge.net/faq/installing_faq.html#install-from-svn

JDH

------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, & 
iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian
Group, R/GA, & Big Spaceship. http://www.creativitycat.com 
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to