- changed status to resolved
Issue #28
resolved
From Matplotlib 3.x, the enter_notify_event requires a x and y coordinate as argument. If this is not passed, None is passed and a matplotlib.cbooks.deprecation.MatplotlibDeprecationWarning warning is raised.
Update the backend to support the x and y parameters in the future.
Here is an example how to temporarily overcome this problem:
import matplotlib.pyplot as plt import numpy as np import warnings import matplotlib.cbook warnings.filterwarnings("ignore",category=matplotlib.cbook.deprecation.MatplotlibDeprecationWarning) fig, ax = plt.subplots() ax.plot(np.random.rand(10)) def onclick(event): print('%s click: button=%d, x=%d, y=%d, xdata=%f, ydata=%f' % ('double' if event.dblclick else 'single', event.button, event.x, event.y, event.xdata, event.ydata)) def onfigureenter(event): if event.x and event.y: print("onfigureenter: x=%f, y=%f, inaxes=%s" % (event.x, event.y,str(event.inaxes))) else: print("onfigureenter: x=<None>, y=<None>, inaxes=%s" % str(event.inaxes)) cid = fig.canvas.mpl_connect('button_press_event', onclick) fig.canvas.mpl_connect('figure_enter_event', onfigureenter)
Remove the filterwarnings command in line 5 to force the warning. Click the canvas to “activate” the plot and then move the mouse out and back again into the canvas.
Comments (1)
-
reporter - Log in to comment
fixes issue
#28to pass the position of the enter event to the Matplotlib backend. The backend now has a backward compatibility mode and emits the old-style signal for enter/leaveEvent as well as new signals with additional position information for the enterEvent (Qt5 only). Update itom as well!→ <<cset 9ee373ed1e9e>>