Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Closed
Milestone
Description
Bug report
Bug summary
In the documentation [1] it says that "figure_enter_event" generates a LocationEvent. However in the source code it just generates the base class Event.
Further investigation showed that some backends do not pass their coordinates when entering the figure. The tkagg backend (default) does not have figure_enter_event nor figure_leave_event.
grep "FigureCanvasBase.enter_notify_event" *pybackend_gtk3.py: FigureCanvasBase.enter_notify_event(self, event)backend_gtk.py: FigureCanvasBase.enter_notify_event(self, event, xy=(x, y))backend_qt5.py: FigureCanvasBase.enter_notify_event(self, guiEvent=event)backend_wx.py: FigureCanvasBase.enter_notify_event(self, guiEvent=evt)
[1] :https://matplotlib.org/users/event_handling.html
Code for reproduction
importmatplotlibmatplotlib.use("Qt5Agg")#may omitimportmatplotlib.pyplotaspltimportnumpyasnpx=range(100)fig,ax=plt.subplots()ax.plot(np.random.rand(10))defstat(event):print("axes: {}, x: {}, y: {}".format(event.inaxes,event.x,event.y))cid=fig.canvas.mpl_connect('figure_enter_event',stat)cid=fig.canvas.mpl_connect('figure_leave_event',stat)plt.show()
Actual outcome
Missing LocationEvent attributes.
Expected outcome
Expect LocationEvent attributes and the documentation to be consistent
Matplotlib version
- Operating system:
- Matplotlib version: 2.1.0, 2.0.2
- Matplotlib backend (
print(matplotlib.get_backend())
): - Python version: 3.5
- Jupyter version (if applicable):
- Other libraries:
Metadata
Metadata
Assignees
Labels
No labels