Get largest limits in the facetgrid. Returns ------- lims_largest : dict[str, tuple[float, float]] Dictionary with the largest limits along each axis. Examples -------- >>> ds = xr.tutorial.scatter_example_dataset(seed=42)
(self)
| 814 | # self._adjust_fig_for_guide(self.quiverkey.text) |
| 815 | |
| 816 | def _get_largest_lims(self) -> dict[str, tuple[float, float]]: |
| 817 | """ |
| 818 | Get largest limits in the facetgrid. |
| 819 | |
| 820 | Returns |
| 821 | ------- |
| 822 | lims_largest : dict[str, tuple[float, float]] |
| 823 | Dictionary with the largest limits along each axis. |
| 824 | |
| 825 | Examples |
| 826 | -------- |
| 827 | >>> ds = xr.tutorial.scatter_example_dataset(seed=42) |
| 828 | >>> fg = ds.plot.scatter(x="A", y="B", hue="y", row="x", col="w") |
| 829 | >>> round(fg._get_largest_lims()["x"][0], 3) |
| 830 | np.float64(-0.334) |
| 831 | """ |
| 832 | lims_largest: dict[str, tuple[float, float]] = dict( |
| 833 | x=(np.inf, -np.inf), y=(np.inf, -np.inf), z=(np.inf, -np.inf) |
| 834 | ) |
| 835 | for axis in ("x", "y", "z"): |
| 836 | # Find the plot with the largest xlim values: |
| 837 | lower, upper = lims_largest[axis] |
| 838 | for ax in self.axs.flat: |
| 839 | get_lim: Callable[[], tuple[float, float]] | None = getattr( |
| 840 | ax, f"get_{axis}lim", None |
| 841 | ) |
| 842 | if get_lim: |
| 843 | lower_new, upper_new = get_lim() |
| 844 | lower, upper = (min(lower, lower_new), max(upper, upper_new)) |
| 845 | lims_largest[axis] = (lower, upper) |
| 846 | |
| 847 | return lims_largest |
| 848 | |
| 849 | def _set_lims( |
| 850 | self, |