GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — ENH: Add pan and zoom toolbar handling to 3D Axes by greglucas · Pull Request #22614 · matplotlib/matplotlib

Conversation

@greglucas

@greglucas greglucas commented Mar 6, 2022

Copy link
Copy Markdown
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 (and pytest passes).
  • Is Flake 8 compliant (install flake8-docstrings and run flake8 --docstring-convention=all).

Documentation

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@greglucas greglucas added the topic: mplot3d label Mar 6, 2022
@greglucas greglucas added this to the v3.6.0 milestone Mar 6, 2022
oscargus
oscargus reviewed Mar 6, 2022
View reviewed changes
Comment thread lib/mpl_toolkits/mplot3d/axes3d.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@greglucas
ENH: Add pan and zoom toolbar handling to 3D Axes
e75f10d
1) 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.

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/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.
@greglucas
greglucas force-pushed the pan-zoom-3d branch from 3981bca to e75f10d Compare March 7, 2022 14:28
@scottshambaugh

scottshambaugh commented Jul 11, 2022

Copy link
Copy Markdown
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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@greglucas

greglucas commented Jul 11, 2022

Copy link
Copy Markdown
Contributor Author

@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!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@timhoffm timhoffm added status: needs revision status: orphaned PR labels Jul 12, 2022
@timhoffm

timhoffm commented Jul 12, 2022

Copy link
Copy Markdown
Member

@scottshambaugh Thanks for testing this PR!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@deeleeramone

deeleeramone commented Jul 17, 2022

Copy link
Copy Markdown

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

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@scottshambaugh

scottshambaugh commented Jul 17, 2022

Copy link
Copy Markdown
Contributor

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@deeleeramone

deeleeramone commented Jul 17, 2022 via email

Copy link
Copy Markdown
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.
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@scottshambaugh scottshambaugh mentioned this pull request Jul 19, 2022
Add pan and zoom toolbar handling to 3D Axes (Replaces PR#22614) #23449
Merged
5 tasks done
@greglucas

greglucas commented Jul 29, 2022 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

superseded by #23449

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@greglucas greglucas closed this Jul 29, 2022
@QuLogic QuLogic modified the milestones: v3.6.0, v3.7.0 Sep 9, 2022
@QuLogic QuLogic added the status: superseded label Dec 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@oscargus oscargus oscargus left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

status: needs revision status: orphaned PR status: superseded topic: mplot3d

Projects

None yet

Milestone

v3.7.0

Development

Successfully merging this pull request may close these issues.

pan and zoom are broken for mplot3d

Uh oh!

There was an error while loading. Please reload this page.

6 participants

@greglucas @scottshambaugh @timhoffm @deeleeramone @oscargus @QuLogic
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.