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

ENH: Add pan and zoom toolbar handling to 3D Axes#22614

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

Closed
greglucas wants to merge1 commit intomatplotlib:mainfromgreglucas:pan-zoom-3d

Conversation

greglucas
Copy link
Contributor

PR Summary

This enables the toolbar buttons to work with 3D axes now. The panning works pretty seamlessly, but the zooming is perhaps not the easiest to use still. This is because it is zooming based on relative locations between the selected box and the Axes, but the Axes actually expands beyond the corners seen in the 3D grid world. If you zoom using the x/y keys to constrain the axes, you will see that the zoom box actually goes a ways outside the 3D world, and then behaves quite well when constrained like that from an intuitive sense. I'm open to suggestions here if anyone can think of a better way to implement the zoom logic, or if we think it is still a bit too complicated and that tool should not be implemented at all.

Test with any of the 3D examples:
https://matplotlib.org/stable/gallery/mplot3d/surface3d.html
https://matplotlib.org/stable/gallery/mplot3d/scatter3d.html

Commit summary:

This moves the pan logic that was already in the mouse move handler
into the "drag_pan" method to make it available from the toolbar.

This also expands upon the panning logic to enable a zoom-to-box feature.
The zoom-to-box is done relative to the Axes, so it shrinks/expands
the box as a fraction of each delta, from lower-left Axes to lower-left
zoom-box. Thus, it tries to handle non-centered zooms, which adds more
cases to handle versus the current right-click zoom only scaling from
the center of the projection.

Closes#110

PR Checklist

Tests and Styling

  • Has pytest style unit tests (andpytest passes).
  • IsFlake 8 compliant (installflake8-docstrings and runflake8 --docstring-convention=all).

Documentation

  • New features are documented, with examples if plot related.
  • [] New features have an entry indoc/users/next_whats_new/ (follow instructions in README.rst there).
  • [N/A] API changes documented indoc/api/next_api_changes/ (follow instructions in README.rst there).
  • Documentation is sphinx and numpydoc compliant (the docs shouldbuild without error).

@greglucasgreglucas added this to thev3.6.0 milestoneMar 6, 2022
1) This moves the pan logic that was already in the mouse move handlerinto the "drag_pan" method to make it available from the toolbar.2) This expands upon the panning logic to enable a zoom-to-box feature.The zoom-to-box is done relative to the Axes, so it shrinks/expandsthe box as a fraction of each delta, from lower-left Axes to lower-leftzoom-box. Thus, it tries to handle non-centered zooms, which adds morecases to handle versus the current right-click zoom only scaling fromthe center of the projection.
@scottshambaugh
Copy link
Contributor

Tried this out today. Something feels off, consider the behavior when I try to zoom in on the corner of this box, and the area I'm zooming in on goes out of frame.
image
image

If I zoom out by deselecting the zoom button and using the right mouse button, I see that the data aspect ratio has changed, which I don't think it should for a near-square zoom box.
image

Don't have time to dig into the logic right now, but that should hopefully give something to dig into here.

@greglucas
Copy link
ContributorAuthor

@scottshambaugh, I think this is likely due to selecting x/y/z coordinates from the 2d-x'y' plane and setting the limits based on those. (i.e. where in depth do those coordinates come from and what depth do we want to use to set the x/y/z limits for the axes?) I agree with you, this is not super ideal as it is currently. Maybe we should just remove the zoom box capability and leave it at pan which I think works better in these cases.

This was a rough attempt a while ago, so I don't have a lot of interest in pushing it through right now. Please feel free to take this over if you have the time/desire!

@timhoffm
Copy link
Member

@scottshambaugh Thanks for testing this PR!

@deeleeramone
Copy link

Greetings, unfortunately, without the canvas layer locking with the zoom, the charts are unusable.

Screen Shot 2022-07-16 at 8 36 39 PM

@scottshambaugh
Copy link
Contributor

I’m taking a stab at this, more to come soon.

@deeleeramone
Copy link

deeleeramone commentedJul 17, 2022 via email

I’ve got an icy-cold beer with your name on it if you can get those hoverable-crosshairs snapping to grid!<3
On Jul 16, 2022, at 8:52 PM, Scott Shambaugh ***@***.***> wrote: I’m taking a stab at this, more to come soon. — Reply to this email directly, view it on GitHub <#22614 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AUOMPBTDMZSFS2G4KA5QTP3VUN7ONANCNFSM5QBXWHXA>. You are receiving this because you commented.

@greglucas
Copy link
ContributorAuthor

greglucas commentedJul 29, 2022
edited
Loading

superseded by#23449

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@oscargusoscargusoscargus left review comments

Assignees
No one assigned
Projects
None yet
Milestone
v3.7.0
Development

Successfully merging this pull request may close these issues.

pan and zoom are broken for mplot3d
6 participants
@greglucas@scottshambaugh@timhoffm@deeleeramone@oscargus@QuLogic

[8]ページ先頭

©2009-2025 Movatter.jp