-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Closed
Milestone
Description
Bug summary
If you combine mplcursor and matplotlib 3.7.1, you'll get an AttributeError: 'NoneType' object has no attribute 'canvas'
after clicking a few data points. Henceforth, selecting a new data point will trigger the same traceback. Otherwise, it works fine.
Code for reproduction
import numpy as np
import matplotlib.pyplot as plt
import mplcursors as mpl
x = np.arange(1, 11)
y1 = x
plt.scatter(x,y1)
mpl.cursor()
plt.show()
Actual outcome
Traceback (most recent call last):
File "C:\Users\MrAni\Python\miniconda3\lib\site-packages\matplotlib\cbook\__init__.py", line 304, in process
func(*args, **kwargs)
File "C:\Users\MrAni\Python\miniconda3\lib\site-packages\matplotlib\offsetbox.py", line 1550, in on_release
if self._check_still_parented() and self.got_artist:
File "C:\Users\MrAni\Python\miniconda3\lib\site-packages\matplotlib\offsetbox.py", line 1560, in _check_still_parented
self.disconnect()
File "C:\Users\MrAni\Python\miniconda3\lib\site-packages\matplotlib\offsetbox.py", line 1568, in disconnect
self.canvas.mpl_disconnect(cid)
File "C:\Users\MrAni\Python\miniconda3\lib\site-packages\matplotlib\offsetbox.py", line 1517, in <lambda>
canvas = property(lambda self: self.ref_artist.figure.canvas)
AttributeError: 'NoneType' object has no attribute 'canvas'
Expected outcome
No terminal output
Additional information
Using matplotlib 3.7.0 or lower works fine. Using a conda install or pip install doesn't affect the output.
Operating system
Windows 11 and Windwos 10
Matplotlib Version
3.7.1
Matplotlib Backend
QtAgg
Python version
3.9.16
Jupyter version
No response
Installation
conda
Metadata
Metadata
Assignees
Labels
No labels