Skip to content
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

Investigate whether we can make use of the new Matplotlib display hook functionality #640

Open
astrofrog opened this issue May 26, 2015 · 1 comment

Comments

@astrofrog
Copy link
Member

See matplotlib/matplotlib#4091

@ChrisBeaumont
Copy link
Member

I've been thinking about this. Ultimately what we want is to redraw stale plots at the end of each "event burst" -- we never want to leave the plot in a stale render, and we also don't want to call draw() more than once during some sequence of state updates that are all within a single "user transaction" (an example of this is the user deleting 10 subsets in one click. We don't want to redraw every plot 10 times as each subset is removed)

It looks like MPL now claims to track when each plot is stale, which is cool if it's robust. So we should be able to remove all calls to draw() in our codebase, and attach a piece of code ...somewhere... to check for and redraw stale plots.

The thing I'm not sure about is where this should be. My vague understanding is that user events in Qt are queued up asynchronously, but Qt periodically processes events by synchronously running the python callbacks attached to each event. Ideally we'd attach a callback that runs at the end of this event loop step. I'm not sure how to do that, but it must be possible.

To support backwards compatibility with older MPL, we could replace all the current draw() calls to something that sets our own stale flag, and uses the same logic to refresh stale plots (ie instead of monkeypatching Canvas.draw within a context manager)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants