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

Add a pre_draw_event event #17168

Open
Open
Labels
New featurekeepItems to be ignored by the “Stale” Github Action
@anntzer

Description

@anntzer

Bug report

Bug summary

draw_event currently firesafter the draw has completed (it is triggered at the end of Figure.draw()). This means it cannot modify the Figure, unless one is willing to trigger a second draw -- and even then one needs to be careful to not recurse infinitely. For example, inhttps://matplotlib.org/3.1.0/gallery/pyplots/auto_subplots_adjust.html (linking the 3.1 version because there's an unrelated bug in 3.2, per#17167), note the call to figure.canvas.draw() at the end of the callback, effectively duplicating the draw(); moreover, if that draw() is moved out of theif block then one gets an infinite recursion. Being able to register a callback to be executedbefore draw() occurs would avoid both problems.
Likewise a pre-draw callback would provide a very general solution for#17052, by allowing one to simply update the colorbar at pre-draw time.

The same feature was rejected because there wasn't a compelling use case in#5042, but I think I exposed more use cases here. See also#10334 re: recursive redraws.

Matplotlib version

  • Operating system:
  • Matplotlib version: 3.2
  • Matplotlib backend (print(matplotlib.get_backend())):
  • Python version:
  • Jupyter version (if applicable):
  • Other libraries:

Metadata

Metadata

Assignees

No one assigned

    Labels

    New featurekeepItems to be ignored by the “Stale” Github Action

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp