Closed saurabh3679 closed 3 years ago
Please clarify what you mean.
If we assign some labels to the ticks on any axis x or y, cursor functionality stops. Try running this code:
import matplotlib.pyplot as plt
import numpy as np
import mplcursors
x = list(np.arange(0,10,1))
y = list(np.arange(11,21,1))
fig, ax = plt.subplots()
lines = ax.plot(x,y)
ax.set_title("Click somewhere on a line.\nRight-click to deselect.\n"
"Annotations can be dragged.")
ax.set_xticklabels(['a','b','c','d','e','f','g','h','i','j'])
mplcursors.cursor(lines) # or just mplcursors.cursor()
plt.show()
This has the same root cause as https://github.com/matplotlib/matplotlib/issues/18727 (mplcursors uses the cursoring mechanism to generate the label). Please comment on that issue if you have a suggestion. Alternatively, you can always manually set the label text.
I have found that module doesn't function as it should if
axes.set_xticklabels()
oraxes.set_yticklabels()
is used in the code.