8000 use RectangleSelector for callbacks and use getter functions for axes by francis-wong · Pull Request #26166 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

use RectangleSelector for callbacks and use getter functions for axes #26166

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

Closed
wants to merge 1 commit into from

Conversation

francis-wong
Copy link

PR summary

  • Closes [Doc]: Cleanup viewlims example #25979
  • Uses RectangleSelector callbacks to redraw images instead of subclassing Rectangle to make it callable
  • Change accessing ax.xlim and ax.ylim properties directly to using ax.get_xlim() and ax.get_ylim() getter functions

PR checklist

@francis-wong
Copy link
Author

This is the same pull request to #26107 which was closed by mistake

Comment on lines +54 to +59
x0, x1 = ax.get_xlim()
y0, y1 = ax.get_ylim()
extent = x0, x1, y0, y1
x0, x1 = ax.get_xlim()
y0, y1 = ax.get_ylim()
extent = x0, x1, y0, y1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
x0, x1 = ax.get_xlim()
y0, y1 = ax.get_ylim()
extent = x0, x1, y0, y1
x0, x1 = ax.get_xlim()
y0, y1 = ax.get_ylim()
extent = x0, x1, y0, y1
x0, x1 = ax.get_xlim()
y0, y1 = ax.get_ylim()
extent = x0, x1, y0, y1

@@ -3,7 +3,7 @@
Viewlims
========

Creates two identical panels. Zooming in on the right panel will show
Creates two identical panels. Zooming in on the left panel will show
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure why this changed; the rectangle is still on the left, and zooming occurs on the right.

Comment on lines 24 to 27
# the area to which we are zoomed.


class MandelbrotDisplay:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revert

Suggested change
# the area to which we are zoomed.
class MandelbrotDisplay:
# the area to which we are zoomed.
class MandelbrotDisplay:


ax1.set_title("Zoom here")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did this change Axes to the left one?

That is, if you mean to say, "use the rectangle selector", then maybe rename to "Select here" instead.

Comment on lines -85 to -87
# Connect for changing the view limits
ax2.callbacks.connect('xlim_changed', rect)
ax2.callbacks.connect('ylim_changed', rect)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I see this part is missing, namely that zooming on the right Axes updates the selector on the left.

@rcomer
Copy link
Member
rcomer commented Aug 5, 2023

Hi @francis-wong are you still interested in working on this?

@oscargus
Copy link
Member
oscargus commented Jan 4, 2024

Superseeded by #27594

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Waiting for author
Development

Successfully merging this pull request may close these issues.

[Doc]: Cleanup viewlims example
5 participants
0