|
From: Michael K. <kau...@or...> - 2014-08-21 18:55:23
|
My user-story is that I have say several axvlines very close together in
bunches in the standard xlim(). Take for example spectral lines (or fits
to spectral lines). I want to pick a line and have the program tell me
the x-location of that line. Since they're close together I need to zoom
in to discriminate them. I don't want to have to zoom in, then move the
mouse to unselect the zoom tool before moving the mouse back to do the
pick or multiple picks.
M
PS: In GTKAgg at least, the zoom tool has a cross-hair pointer which in
my opinion is even better than the arrow.
On 8/21/14 2:41 PM, Benjamin Root wrote:
> Imagine someone creates some event that would modify an artist upon
> picking, or do some expensive calculation, or some other action. But, I
> seriously doubt anybody would want those actions to fire while using the
> zoom/pan tool. Especially since the mouse cursor looks totally
> different. I am curious why you would expect pick events to fire while
> using pan/zoom. What is the user-story that compels that expectation?
> Perhaps I could be convinced otherwise to offer some sort of toggle.
>
>
>
> On Thu, Aug 21, 2014 at 2:33 PM, Michael Kaufman <kau...@or...
> <mailto:kau...@or...>> wrote:
>
> What kind of bad stuff happens if we were to allow that?
>
> M
>
>
> On 8/21/14 2:29 PM, Benjamin Root wrote:
>
> Yes, those tools do "snarf" up pick events via the widgetlock
> mechanism,
> IIRC. This is entirely intentional, and I an not sure there is a bug
> here to fix.
>
>
> On Thu, Aug 21, 2014 at 12:01 PM, Thomas Caswell
> <tca...@gm... <mailto:tca...@gm...>
> <mailto:tca...@gm... <mailto:tca...@gm...>>> wrote:
>
> On Thu, Aug 21, 2014 at 9:44 AM, Michael Kaufman
> <kau...@or... <mailto:kau...@or...>
> <mailto:kau...@or... <mailto:kau...@or...>>> wrote:
> >
> > # plot axvlines here... etc.
> >
> > global cids
> >
> > # remove any previous connections
> > for i in cids:
> > gcf().canvas.mpl_disconnect(i)
> > cids = []
> >
> >
> cids.append(gcf().canvas.mpl___connect('pick_event',self.__pick))
> >
>
> cids.append(gcf().canvas.mpl___connect('button_press_event',__self.click))
> >
> > draw()
> >
> > def pick(self, event):
> > thisline = event.artist
> > xdata, ydata = thisline.get_data()
> > print xdata[0]
> >
> > def click(self, event):
> > print "clicked"
>
>
> See this minimal example
>
> ```
> import matplotlib.pyplot as plt
> fig, ax = plt.subplots()
>
> ax.axvline(.5, picker=6)
> ax.plot(range(3))
> cids = []
>
> plt.draw()
>
> def pick(event):
> thisline = event.artist
> xdata, ydata = thisline.get_data()
> print xdata[0]
>
> def click(event):
> print "clicked"
>
>
> cids.append(fig.canvas.mpl___connect('pick_event', pick))
> cids.append(fig.canvas.mpl___connect('button_press_event',
> click))
>
> ```
>
> If you turn the zoom/pan tool off the picker works again.
> I suspect
> that there is some logic underneath those tools that are
> snarfing
> events when the are turned on to avoid messy conflicts.
> There is some
> work going on (MEP22 iirc) to update the toolbar and make
> our tool
> handling saner.
>
> Tom
> --
> Thomas Caswell
> tca...@gm... <mailto:tca...@gm...>
> <mailto:tca...@gm... <mailto:tca...@gm...>>
>
>
>
> ------------------------------__------------------------------__------------------
> Slashdot TV.
> Video for Nerds. Stuff that matters.
> http://tv.slashdot.org/
> _________________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.__sourceforge.net
> <mailto:Mat...@li...>
> <mailto:Matplotlib-users@__lists.sourceforge.net
> <mailto:Mat...@li...>>
> https://lists.sourceforge.net/__lists/listinfo/matplotlib-__users <https://lists.sourceforge.net/lists/listinfo/matplotlib-users>
>
>
>
>
|