Pick events, by default, won't fire while the zoom/pan tool is active,
because there is no way to distinguish between a "pick" click, and a click
for performing a zoom/pan. So, the question is really, is it sensible to
keep the tools active after their action. I think it is, particularly when
considering the panning tool, as it may take multiple "pans" before I
finding what I want.
You can easily turn the various tools on and off via keyboard shortcuts:
http://matplotlib.org/users/navigation_toolbar.html#navigation-keyboard-shortcuts
Command Keyboard Shortcut(s) Home/Reset *h* or *r* or *home* Back *c* or *left
arrow* or *backspace* Forward *v* or *right arrow* Pan/Zoom *p* Zoom-to-rect
*o* Save *ctrl* + *s* Toggle fullscreen *ctrl* + *f* Close plot *ctrl*
+ *w* Constrain
pan/zoom to x axis hold *x* when panning/zooming with mouse Constrain
pan/zoom to y axis hold *y* when panning/zooming with mouse Preserve aspect
ratio hold *CONTROL* when panning/zooming with mouse Toggle grid *g* when
mouse is over an axes Toggle x axis scale (log/linear) *L* or *k* when
mouse is over an axes Toggle y axis scale (log/linear) *l* when mouse is
over an axes
Does this solve the issue, or do we need something more configurable?
Cheers!
Ben Root
On Thu, Aug 21, 2014 at 3:02 PM, Joe Kington <joferking...@gmail.com> wrote:
> I think the OP's desire is to have pick events fire after the zoom has
> been triggered.
>
> Currently, after you zoom (or pan), the zoom tool is still active until
> you click it again. Pick events won't fire while the zoom tool is the
> selected tool, and you have to manually de-select it (i.e. click the zoom
> button again for pick events to work).
>
> The current behavior is the right default choice, i.m.o., but it's
> counter-intuitive when combined with pick events.
>
> When you're building a gui to interact with data (or, for example, when
> using mpldatacursor -- this is a question I get a lot), a common
> expectation is that after you zoom once, the zoom tool is no longer
> active. Pick events should work again.
>
> Currently, you have to subclass (or monkey-patch) the toolbar to make this
> happen. It's a bit of a pain. (It's more complicated that just setting
> `fig.canvas.toolbar._active`.) (If I'm wrong about that, please let me
> know!!!)
>
> It would be nice to have an easier way to "deactivate" the zoom/pan tool.
> I think the "new" toolbar might have that, but I haven't checked.
>
> Cheers,
> -Joe
>
>
> On Thu, Aug 21, 2014 at 1:41 PM, Benjamin Root <ben.r...@ou.edu> 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 <kaufma...@ornl.gov>
>> 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 <tcasw...@gmail.com
>>>> <mailto:tcasw...@gmail.com>> wrote:
>>>>
>>>> On Thu, Aug 21, 2014 at 9:44 AM, Michael Kaufman <
>>>> kaufma...@ornl.gov
>>>> <mailto:kaufma...@ornl.gov>> 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
>>>> tcasw...@gmail.com <mailto:tcasw...@gmail.com>
>>>>
>>>>
>>>> ------------------------------------------------------------
>>>> ------------------
>>>> Slashdot TV.
>>>> Video for Nerds. Stuff that matters.
>>>> http://tv.slashdot.org/
>>>> _______________________________________________
>>>> Matplotlib-users mailing list
>>>> Matplotlib-users@lists.sourceforge.net
>>>> <mailto:Matplotlib-users@lists.sourceforge.net>
>>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>>>
>>>>
>>>>
>>>
>>
>>
>> ------------------------------------------------------------------------------
>> Slashdot TV.
>> Video for Nerds. Stuff that matters.
>> http://tv.slashdot.org/
>> _______________________________________________
>> Matplotlib-users mailing list
>> Matplotlib-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>>
>
------------------------------------------------------------------------------
Slashdot TV.
Video for Nerds. Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users