Set the same limits for all the subplots in the facetgrid. Parameters ---------- x : tuple[float, float] or None, optional x axis limits. y : tuple[float, float] or None, optional y axis limits. z : tuple[float, float] or None
(
self,
x: tuple[float, float] | None = None,
y: tuple[float, float] | None = None,
z: tuple[float, float] | None = None,
)
| 847 | return lims_largest |
| 848 | |
| 849 | def _set_lims( |
| 850 | self, |
| 851 | x: tuple[float, float] | None = None, |
| 852 | y: tuple[float, float] | None = None, |
| 853 | z: tuple[float, float] | None = None, |
| 854 | ) -> None: |
| 855 | """ |
| 856 | Set the same limits for all the subplots in the facetgrid. |
| 857 | |
| 858 | Parameters |
| 859 | ---------- |
| 860 | x : tuple[float, float] or None, optional |
| 861 | x axis limits. |
| 862 | y : tuple[float, float] or None, optional |
| 863 | y axis limits. |
| 864 | z : tuple[float, float] or None, optional |
| 865 | z axis limits. |
| 866 | |
| 867 | Examples |
| 868 | -------- |
| 869 | >>> ds = xr.tutorial.scatter_example_dataset(seed=42) |
| 870 | >>> fg = ds.plot.scatter(x="A", y="B", hue="y", row="x", col="w") |
| 871 | >>> fg._set_lims(x=(-0.3, 0.3), y=(0, 2), z=(0, 4)) |
| 872 | >>> fg.axs[0, 0].get_xlim(), fg.axs[0, 0].get_ylim() |
| 873 | ((np.float64(-0.3), np.float64(0.3)), (np.float64(0.0), np.float64(2.0))) |
| 874 | """ |
| 875 | lims_largest = self._get_largest_lims() |
| 876 | |
| 877 | # Set limits: |
| 878 | for ax in self.axs.flat: |
| 879 | for (axis, data_limit), parameter_limit in zip( |
| 880 | lims_largest.items(), (x, y, z), strict=True |
| 881 | ): |
| 882 | set_lim = getattr(ax, f"set_{axis}lim", None) |
| 883 | if set_lim: |
| 884 | set_lim(data_limit if parameter_limit is None else parameter_limit) |
| 885 | |
| 886 | def set_axis_labels(self, *axlabels: Hashable) -> None: |
| 887 | """Set axis labels on the left column and bottom row of the grid.""" |
no test coverage detected