|
From: marc d. <mde...@ya...> - 2009-08-22 21:20:40
|
I created a simple scatter plot and a service routine to print out the coordinates of the points I pick with the cursor (based on the demo). It works until I select the pan or zoom cursor. After I zoom or pan, I can no longer get back to the normal cursor which allows me to "pick" a circle. Even clicking "home" doesn't help.
The code is shown below
--------------------------------------------------------------------------------
from matplotlib import figure,pyplot
from numpy import linspace,sin,take
fig=pyplot.figure()
ax1=fig.add_subplot(1,1,1) # (numRows, numCols, plotNum)
t=linspace(0,10,100)
y1=sin(5*t)
y2=y1+sin(10*t)
line1=ax1.scatter(y1,y2,picker=True)
def onpick1(event):
ind = event.ind
print 'onpick1 scatter:', ind, take(y1, ind), take(y2, ind)
fig.canvas.mpl_connect('pick_event', onpick1)
pyplot.show()
--------------------------------------------------------------------------------
this is based on the demo at
http://matplotlib.sourceforge.net/examples/event_handling/pick_event_demo.html?highlight=scatter
Marc Desmarais
537 Park Av.
Long Beach, CA, 90814
(562) 712 8682 cell
|
|
From: Kjell M. F. <kj...@gm...> - 2010-02-24 13:07:11
|
marc desmarais-2 wrote:
>
> I created a simple scatter plot and a service routine to print out the
> coordinates of the points I pick with the cursor (based on the demo). It
> works until I select the pan or zoom cursor. After I zoom or pan, I can
> no longer get back to the normal cursor which allows me to "pick" a
> circle. Even clicking "home" doesn't help.
>
> The code is shown below
>
> --------------------------------------------------------------------------------
> from matplotlib import figure,pyplot
> from numpy import linspace,sin,take
>
> fig=pyplot.figure()
>
> ax1=fig.add_subplot(1,1,1) # (numRows, numCols, plotNum)
>
> t=linspace(0,10,100)
> y1=sin(5*t)
> y2=y1+sin(10*t)
>
> line1=ax1.scatter(y1,y2,picker=True)
>
> def onpick1(event):
> ind = event.ind
> print 'onpick1 scatter:', ind, take(y1, ind), take(y2, ind)
>
> fig.canvas.mpl_connect('pick_event', onpick1)
> pyplot.show()
> --------------------------------------------------------------------------------
>
>
I ran into the same problem today. Does someone know of a workaround? I use
a recent version of matplotlib and the default tk backend. It seems like the
tool bar overrides any user defined events. Is there a way to deactivate the
zoom and pan cursors?
- Kjell Magne Fauske
--
View this message in context: http://old.nabble.com/can%27t-picker-once-pan-or-zoom-chosen-tp25097973p27714178.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
|
|
From: Kjell M. F. <kj...@gm...> - 2010-02-24 13:07:06
|
Kjell Magne Fauske wrote: > > > I ran into the same problem today. Does someone know of a workaround? I > use a recent version of matplotlib and the default tk backend. It seems > like the tool bar overrides any user defined events. Is there a way to > deactivate the zoom and pan cursors? > > - Kjell Magne Fauske > I'm sorry for the noise. To disable the zoom and pan cursors you just have to click the zoom or pan button again. Picking will then start working again. - Kjell Magne -- View this message in context: http://old.nabble.com/can%27t-picker-once-pan-or-zoom-chosen-tp25097973p27714182.html Sent from the matplotlib - users mailing list archive at Nabble.com. |
|
From: bdb112 <boy...@an...> - 2011-04-02 23:16:32
|
Straightfoward solution is to deselect zoom or pan by clicking those buttons
again. The cursor returns to the "Arrow" shape.
Any better solution?
marc desmarais-2 wrote:
>
> I created a simple scatter plot and a service routine to print out the
> coordinates of the points I pick with the cursor (based on the demo). It
> works until I select the pan or zoom cursor. After I zoom or pan, I can
> no longer get back to the normal cursor which allows me to "pick" a
> circle. Even clicking "home" doesn't help.
>
> The code is shown below
>
> --------------------------------------------------------------------------------
> from matplotlib import figure,pyplot
> from numpy import linspace,sin,take
>
> fig=pyplot.figure()
>
> ax1=fig.add_subplot(1,1,1) # (numRows, numCols, plotNum)
>
> t=linspace(0,10,100)
> y1=sin(5*t)
> y2=y1+sin(10*t)
>
> line1=ax1.scatter(y1,y2,picker=True)
>
> def onpick1(event):
> ind = event.ind
> print 'onpick1 scatter:', ind, take(y1, ind), take(y2, ind)
>
> fig.canvas.mpl_connect('pick_event', onpick1)
> pyplot.show()
> --------------------------------------------------------------------------------
>
> this is based on the demo at
>
> http://matplotlib.sourceforge.net/examples/event_handling/pick_event_demo.html?highlight=scatter
>
> Marc Desmarais
>
> 537 Park Av.
>
> Long Beach, CA, 90814
>
>
>
> (562) 712 8682 cell
>
>
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008
> 30-Day
> trial. Simplify your report design, integration and deployment - and focus
> on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now. http://p.sf.net/sfu/bobj-july
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
--
View this message in context: http://old.nabble.com/can%27t-picker-once-pan-or-zoom-chosen-tp25097973p31305018.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
|