-
Notifications
You must be signed in to change notification settings - Fork 369
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
Gridliner: don't destroy and recreate artists #2252
Conversation
Putting this one in draft as it will need rebasing once #2249 is merged. |
dceee93
to
ce1bc96
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested this out locally zooming and panning around and it seems quite responsive to me, nice work!
One minor pre-commit failure to fix before merging.
ce1bc96
to
8fd21a3
Compare
Apologies, I don't know how I managed to push that failure as I have pre-commit installed locally. I should have checked the CI myself though. |
I broke the minimum versions tests. In fact I broke them at #2249: |
I note that mpl v3.5 is two years old next month, so the easiest fix would be to move the pin. The problem calls are only in the tests. |
:( I should have checked that during the review but I was only looking at the ones without min-version specified. That is the problem when you have external issues causing red x's throughout the test suite. I'd say it should probably be a separate commit, but I'm fine having it in this PR if that is easier than a new PR.
I'd say that bumping the pin is fine then. We are not going to release within the next month. Note that you should also probably remove any other MPL3_4 checks there are (if any) and remove that code too, and if so then a new PR might be worthwhile. |
👍 to what @greglucas said above. |
I decided to put it in a separate PR #2258 |
I think this one is now ready to go. The only change since @greglucas' approval is the flake8 fix and I have also checked that all the test runs have exactly ten failures. |
Still looks good to me. I verified the test runs as well. |
Rationale
@greglucas has asked for this at least twice!
When re-drawing the
GridLiner
, update its existingLineCollection
andText
objects rather than creating new ones. This was trivial for theLineCollection
s but a bit more complicated for the labels since we might have different numbers of them e.g. after zooming. Clearly Matplotlib'sAxis
has already solved that problem so I got my inspiration from there. We now keep two lists of labels:_all_labels
is the list of labels that have been drawn at some point._labels
is the list that were used at the most recent draw (and still gets cleared out and repopulated each time).Goes on top of #2249.
Only the third commit is new.Implications