-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add helper for setting axis limits in facetgrid #7046
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
Conversation
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.
Small comment but I am also fine to merge as is.
xarray/plot/facetgrid.py
Outdated
# Find the plot with the largest xlim values: | ||
for ax in self.axes.flat: | ||
get_lim: None | Callable[[], tuple[float, float]] = getattr( | ||
ax, f"get_{k}lim", None | ||
) | ||
if get_lim: | ||
l0, l1 = get_lim() | ||
l0_old, l1_old = lims_largest[k] | ||
lims_largest[k] = (min(l0, l0_old), max(l1, l1_old)) |
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.
You could potentially avoid some dict lookups and only assign them at the end - but I don't think it really matters.
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.
Hmm, I'm not seeing what you're seeing. Feel free to push a commit if you like.
Co-authored-by: Mathias Hauser <[email protected]>
Thanks @mathause! I'll merge this in a few days. |
You don't need to specify |
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.
a bit late, but I've got a few comments that might be good to address. The outdated parameter types should definitely be updated but I won't insist on renaming the variables.
To be continued in #7082. |
This PR adds a helper method that sets the same axis limits for all plots in a facetgrid.
Helpful when
Split up from #6778.