matplotlib - How get a (x,y) position pointing with mouse in a interactive plot (Python)? -


i use ipython notebook (with magic %matplotlib nbagg). reviewing matplotlib.widget.cursor cursor viewed widgets.cursor. i'd select 2 points clicking in plot , initial , final x,y-position (e.g. time vs temperature, selecting points must return initial , final time). need selecting manually arbitrary interval.i think it's similar get global x,y position, didn't understand in post.

obs. similar cursor procedure in idl

event handling should work.

import matplotlib.pylab plt import numpy np  f,a = plt.subplots() x = np.linspace(1,10,100) y = np.sin(x) a.plot(x,y) pos = [] def onclick(event):     pos.append([event.xdata,event.ydata]) f.canvas.mpl_connect('button_press_event', onclick) f.show() 

on each click current cursor position appended pos.


Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -