mpldatacursor icon indicating copy to clipboard operation
mpldatacursor copied to clipboard

draggable not working

Open walidbou6 opened this issue 2 years ago • 1 comments

first, thank you for the great job you did, (I was trying for about 2 days to make this stuff, great job) anyway I have tested the following code:

import matplotlib.pyplot as plt
import numpy as np
from mpldatacursor import datacursor
data = np.outer(range(10), range(1, 5))
fig, ax = plt.subplots()
ax.set_title('Try dragging the annotation boxes')
ax.plot(data)
datacursor(display='multiple', draggable=True)
plt.show()

but the draggable function didn't work for me, any idea why?

OS: Windows 10 Python: 3.8.5 Matplotlib: 3.3.2

walidbou6 avatar Mar 08 '22 17:03 walidbou6

Basic Usage exampe also not working. Are there any hints?

Basic Usage Example

import matplotlib.pyplot as plt
import numpy as np
from mpldatacursor import datacursor

data = np.outer(range(10), range(1, 5))

fig, ax = plt.subplots()
lines = ax.plot(data)
ax.set_title('Click somewhere on a line')

datacursor(lines)

plt.show()

Error Message

Traceback (most recent call last):
  File "...../python3.10/site-packages/matplotlib/cbook/__init__.py", line 287, in process
    func(*args, **kwargs)
  File "...../python3.10/site-packages/mpldatacursor/datacursor.py", line 704, in _select
    fixed_event = event_axes_data(event, anno.axes)
  File "...../python3.10/site-packages/mpldatacursor/datacursor.py", line 687, in event_axes_data
    x, y = ax.transData.inverted().transform_point(point)
AttributeError: 'NoneType' object has no attribute 'transData'

gituser789 avatar Jul 05 '22 08:07 gituser789