Parameters ---------- data : DataArray or Dataset DataArray or Dataset to be plotted. row, col : hashable or None, optional Dimension names that define subsets of the data, which will be drawn on separate facets in the grid.
(
self,
data: T_DataArrayOrSet,
col: Hashable | None = None,
row: Hashable | None = None,
col_wrap: int | Literal["auto"] | None = None,
sharex: bool = True,
sharey: bool = True,
figsize: Iterable[float] | None = None,
aspect: float = 1,
size: float = 3,
subplot_kws: dict[str, Any] | None = None,
)
| 150 | _finalized: bool |
| 151 | |
| 152 | def __init__( |
| 153 | self, |
| 154 | data: T_DataArrayOrSet, |
| 155 | col: Hashable | None = None, |
| 156 | row: Hashable | None = None, |
| 157 | col_wrap: int | Literal["auto"] | None = None, |
| 158 | sharex: bool = True, |
| 159 | sharey: bool = True, |
| 160 | figsize: Iterable[float] | None = None, |
| 161 | aspect: float = 1, |
| 162 | size: float = 3, |
| 163 | subplot_kws: dict[str, Any] | None = None, |
| 164 | ) -> None: |
| 165 | """ |
| 166 | Parameters |
| 167 | ---------- |
| 168 | data : DataArray or Dataset |
| 169 | DataArray or Dataset to be plotted. |
| 170 | row, col : hashable or None, optional |
| 171 | Dimension names that define subsets of the data, which will be drawn |
| 172 | on separate facets in the grid. |
| 173 | col_wrap : int, None or "auto", optional |
| 174 | "Wrap" the grid for the column variable after this number of columns, |
| 175 | adding rows if ``col_wrap`` is less than the number of facets. |
| 176 | If "auto" align the grid to the figsize or keep it as square as possible. |
| 177 | sharex : bool, default: True |
| 178 | If true, the facets will share *x* axes. |
| 179 | sharey : bool, default: True |
| 180 | If true, the facets will share *y* axes. |
| 181 | figsize : Iterable of float or None, optional |
| 182 | A tuple (width, height) of the figure in inches. |
| 183 | If set, overrides ``size`` and ``aspect``. |
| 184 | aspect : scalar, default: 1 |
| 185 | Aspect ratio of each facet, so that ``aspect * size`` gives the |
| 186 | width of each facet in inches. |
| 187 | size : scalar, default: 3 |
| 188 | Height (in inches) of each facet. See also: ``aspect``. |
| 189 | subplot_kws : dict, optional |
| 190 | Dictionary of keyword arguments for Matplotlib subplots |
| 191 | (:py:func:`matplotlib.pyplot.subplots`). |
| 192 | """ |
| 193 | |
| 194 | import matplotlib.pyplot as plt |
| 195 | |
| 196 | # Handle corner case of nonunique coordinates |
| 197 | rep_col = col is not None and not data[col].to_index().is_unique |
| 198 | rep_row = row is not None and not data[row].to_index().is_unique |
| 199 | if rep_col or rep_row: |
| 200 | raise ValueError( |
| 201 | "Coordinates used for faceting cannot " |
| 202 | "contain repeated (nonunique) values." |
| 203 | ) |
| 204 | |
| 205 | # single_group is the grouping variable, if there is exactly one |
| 206 | single_group: bool | Hashable |
| 207 | if col and row: |
| 208 | single_group = False |
| 209 | nrow = len(data[row]) |
nothing calls this directly
no test coverage detected