-
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
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
Enable interactive figure resizing for webagg and nbagg backends #24083
Conversation
Can you address the style issues? This seems reasonable to me, thank you! |
I am confused; resizing already works in both webagg and nbagg. |
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 don't mean to discourage you, but I don't know why this needs to be done.
Sorry, I was also confused as I trusted that resizing did not currently work in webagg. |
Could you confirm if it works? At least on Safari it's never worked for me - the div is resizable but the canvas at front is opaque and completely overlaps the div, making it unable to resize by dragging the corner. @QuLogic I have made the changes. |
I see.. WebAgg resizing works on Chrome, but not on Safari, which I use most of the time. Screen.Recording.2022-10-04.at.11.20.21.AM.movScreen.Recording.2022-10-04.at.11.21.26.AM.mov |
@zhizheng1 Did you mean to close this? If it fixes webagg in safari that is something we should take. |
@tacaswell I think we have a better solution @QuLogic that leverages browser's built-in resizing capability instead of implementing our own. Just FYI, I also updated our patch script per this new idea (a one-liner only now!), which is shorter and more performant: sed -i.0 -e 's/this.rubberband_canvas.ad/canvas_div.ad/g' -e 's/rubberband_canvas.ad/canvas_div.ad/g' -e 's/z-index: 1;/& pointer-events: none;/g' -e "s/+ height + 'px;'/& + 'pointer-events: none;'/g" -e 's/rubberband_canvas.st/canvas_div.st/g' ./$VENV/lib/*/*/matplotlib/*/*/*/mpl.js Applying the above one-liner to current production MPL 3.6.0 will enable resizing in safari. At the very least, I don't think this PR is necessary any more.. |
PR Summary
This PR adds support for interactively resizing figures when using WebAgg or NbAgg backends. It essentially backports the logic used in ipympl which supports the same manner of resizing (i.e. dragging the bottom right corner).
Note the same logic applies to both webagg and nbagg (via mpl.js).
Fixes #24075
PR Checklist
Tests and Styling
pytest
passes).flake8-docstrings
and runflake8 --docstring-convention=all
).Documentation
doc/users/next_whats_new/
(follow instructions in README.rst there).doc/api/next_api_changes/
(follow instructions in README.rst there).193451951-c07869c9-cb53-4e48-91d0-1fb03650d04e.mov
Screen.Recording.2022-10-03.at.3.05.19.PM.mov