mpldatacursor icon indicating copy to clipboard operation
mpldatacursor copied to clipboard

Added a Parameter interpolate_pickpos

Open sapus opened this issue 11 years ago • 4 comments

I wannted to have a simple way to look at original plotted data without any interpolation. I think this is a "should have" for a data cursor.

sapus avatar Feb 18 '14 14:02 sapus

@joferkington, could you please have a look at this? Can this be un-bitrotted and merged? Or should the "python 3 support" commits be removed?

jondo avatar Apr 21 '15 15:04 jondo

@jondo - The python3 related commits were merged in a separate pull request by @sapus well before this pull request (e.g. https://github.com/joferkington/mpldatacursor/commit/c0e1950e547a4e6af48fc319c7b516a930049942 )

Note that there were a couple of lingering unicode differences with python3 that I missed up until https://github.com/joferkington/mpldatacursor/issues/25 (i.e. the git HEAD has these fixes but the current release version doesn't).

I've left this pull request open as a reminder to myself to implement an option not to follow the line of a Line2D. However, it can't quite be implemented as it is here, and implementing in general (for all artists) is considerably harder.

In the meantime, here's a workaround if you want to snap to only verticies of a Line2D and not the line itself (note that you can also accomplish this through the props_override kwarg, similar to the bar example, but it's easier to use two artists in this case).

import matplotlib.pyplot as plt
import mpldatacursor

x, y = range(10), range(10)

fig, ax = plt.subplots()
line, = ax.plot(x, y, 'b-')
points, = ax.plot(x, y, 'bo')

mpldatacursor.datacursor(points)
plt.show()

joferkington avatar Apr 21 '15 15:04 joferkington

@joferkington - I understand. Nice workaround, I'll try that!

jondo avatar Apr 21 '15 22:04 jondo

how to capture the max value aroud the cursor , just like interactive annotation in matlab . how to use props_override, i am confused, thank you .

lzj-r avatar Apr 18 '20 16:04 lzj-r