Skip to content

Speed up canvas redraw for GTK3Agg backend. #12030

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 19, 2018
Merged

Speed up canvas redraw for GTK3Agg backend. #12030

merged 2 commits into from
Sep 19, 2018

Conversation

akhilman
Copy link
Contributor

@akhilman akhilman commented Sep 6, 2018

PR Summary

Move _render_figure() call out of on_draw_event handler
in FigureCanvasGTK3Agg class and call it from overloaded
draw() method.
Fixes #12010

Gtk triggers draw event not only when actual plot redraw
required but also when any another widget drawn over canvas.
This makes application with embided plot unresponsive in cases
when popover or popup menu are drawn over plot.
You may try example provided in #12010.

Moving actual plot redraw out of on_draw_event() makes GUI
much more responsive.

This changes tested with:

  • animation from examples/ directory
  • interacive pan and zoom
  • cursor widget with bliting
  • calling draw_idle() to update interactive chart

PR Checklist

  • Has Pytest style unit tests
  • Code is Flake 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

Move `_render_figure()` call out of `on_draw_event` handler
in `FigureCanvasGTK3Agg` class and call it from overloaded
`draw()` method.
Fixes #12010

Gtk triggers `draw` event not only when actual plot redraw
required but also when any another widget drawn over canvas.
This makes application with embided plot unresponsive in cases
when popover or popup menu are drawn over plot.
You may try example provided in #12010.

Moving actual plot redraw out of `on_draw_event()` makes GUI
much more responsive.

This changes tested with:
* animation from examples/ directory
* interacive pan and zoom
* cursor widget with bliting
* calling draw_idle() to update interactive chart
@tacaswell tacaswell added this to the v3.0 milestone Sep 6, 2018
@tacaswell
Copy link
Member

attn @fariza @OceanWolf

@akhilman
Copy link
Contributor Author

akhilman commented Sep 6, 2018

my bad, still have some issues with this patch, I'll fix it

Fix for previous commit.
@tacaswell tacaswell modified the milestones: v3.0, v3.1 Sep 10, 2018
Copy link
Member

@fariza fariza left a comment

Choose a reason for hiding this comment

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

I tested the solution and seems to work fine.

@fariza
Copy link
Member

fariza commented Sep 14, 2018

@tacaswell are we enforcing all the coverage tests?

@anntzer
Copy link
Contributor

anntzer commented Sep 17, 2018

Only on a best-effort basis for the interactive backends; I think this PR can go in if you're happy with it regardless of coverage.

@QuLogic QuLogic merged commit 51c77d6 into matplotlib:master Sep 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Popover over plot is very slow
5 participants