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

Avoid event accumulation in webagg backend.#27160

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
raphaelquast wants to merge8 commits intomatplotlib:main
base:main
Choose a base branch
Loading
fromraphaelquast:webagg_blit_fix

Conversation

raphaelquast
Copy link
Contributor

PR summary

This PR is intended to address the problem of event-accumulation during image-processing in thewebagg backend
which can result in an extreme lag that makes "fast updated" events likemotion_notify_event etc. unusable at the moment.

Not 100% sure, but this might also improve problems concerning blitting in jupyter-notebooks (e.g.#19116) but would require sending"ack" messages inipympl. The implementation is made in a way such thatipympl (or more generally backends that don't send"ack" messages) are not affected.

The following gifs show the outcome of this change: (left: current behavior,right: result of this PR)

🐍 code to run example
importmatplotlibasmplmpl.use("webagg")mpl.rcParams['webagg.port']=8988mpl.rcParams['webagg.open_in_browser']=Trueimportmatplotlib.pyplotaspltfig,ax=plt.subplots(figsize=(14,8))ax.plot([0,1], [0,1],'r')ln,=ax.plot([0,1], [0,0],'g',animated=True)ax.figure.canvas.draw()fig._last_blit_bg=fig.canvas.copy_from_bbox(ax.bbox)defon_resize(event):ax.figure.canvas.draw()fig._last_blit_bg=fig.canvas.copy_from_bbox(ax.bbox)defon_move(event):ax.figure.canvas.restore_region(fig._last_blit_bg)ln.set_ydata([event.ydata,event.ydata])ax.draw_artist(ln)ax.figure.canvas.blit(ax.bbox)fig.canvas.mpl_connect('motion_notify_event',on_move)fig.canvas.mpl_connect('resize_event',on_resize)plt.show()

PR checklist

@tacaswell
Copy link
Member

Comments from call:

  • add ability to opt-in to this behavior with a string control (so we can support other stratgies)
  • look into de-bouncing inblit as well

attn@ianhi

@raphaelquastraphaelquast mentioned this pull requestDec 7, 2023
30 tasks
@ghost
Copy link

I am using an interactive ipympl widget in an application, that would profit a lot from blitting, so i have been waiting for this PR to be merged. Thank you for the promising work done.
I just wanted to ask now, if we can expect this to be merged eventually, or if development has stopped, or is happening somewhere else, or ... ?

@raphaelquast
Copy link
ContributorAuthor

Hey, just a quick comment from my side:
I would be really happy if this PR is merged sometime soon...
Unfortunately however, I have absolutely no time right now to continue working on the remaining issues that need to be resolved and it will stay this way for a few months more...

I am happy if someone takes over in the meantime, otherwise I'll try to continue working on it as soon as i find some time (best guess is sometime early next year).

@sjmarwitz you could also monkey-patch the fix in the meantime to check if it does the job for you... I implemented a workaround forEOmaps ( seehere)

@ghost
Copy link

ghost commentedSep 26, 2024
edited by ghost
Loading

@raphaelquast Thanks for your quick response and for pointing me to your monkey-path fix. I tried it and immediately hit the problem with ipympl, that was already mentioned in the PR summary. Actually, when using ipympl, after the initial display of a figure, it won't update the canvas/figure, not even zooming or panning is possible. It seems, no 'ack' messages are being received (and sent?).

I would have liked to contribute a fix somehow, given the limited amount of time i have, but looking into the ipympl code, i got lost, as i don't "speak" js and the like and are not familiar with web technologies.


# Keep track of the number of received ack messages.
if self._num_received_images is None:
self._num_received_images = 0 # To support no "ack" messages.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Don't know what this comment means.

Co-authored-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
raphaelquastand others added2 commitsMarch 5, 2025 09:39
Co-authored-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
Co-authored-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@QuLogicQuLogicQuLogic left review comments

@timhoffmtimhoffmAwaiting requested review from timhoffm

At least 1 approving review is required to merge this pull request.

Assignees
No one assigned
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

4 participants
@raphaelquast@tacaswell@QuLogic@timhoffm

[8]ページ先頭

©2009-2025 Movatter.jp