Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Closed
Milestone
Description
Seejoferkington/mpldatacursor#36.
Briefly,Line2D.contains
currently assumes that points in the line are connected by straight segments, thus ignoringdrawstyle
. Minimal example (edited from the event handling doc):
import numpy as npimport matplotlib.pyplot as pltfig = plt.figure()ax = fig.add_subplot(111)ax.set_title('click on points')line, = ax.plot(np.random.rand(10), picker=5, drawstyle="steps-pre") # 5 points tolerancedef onpick(event): thisline = event.artist xdata = thisline.get_xdata() ydata = thisline.get_ydata() ind = event.ind points = tuple(zip(xdata[ind], ydata[ind])) print('onpick points:', points)fig.canvas.mpl_connect('pick_event', onpick)plt.show()
Clicking on the drawn line does not always trigger an event. Clicking on the not-drawn "straight" segments connecting the data points does.
Metadata
Metadata
Assignees
Labels
No labels