Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

figure_enter_event generates base Event and not LocationEvent #9812

Closed
Milestone
@lkjell

Description

@lkjell

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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp