|
40 | 40 | "use_numbagg", |
41 | 41 | "use_opt_einsum", |
42 | 42 | "use_flox", |
| 43 | + "facetgrid_figsize", |
43 | 44 | ] |
44 | 45 |
|
45 | 46 | class T_Options(TypedDict): |
@@ -73,6 +74,7 @@ class T_Options(TypedDict): |
73 | 74 | use_new_combine_kwarg_defaults: bool |
74 | 75 | use_numbagg: bool |
75 | 76 | use_opt_einsum: bool |
| 77 | + facetgrid_figsize: Literal["computed", "rcparams"] |
76 | 78 |
|
77 | 79 |
|
78 | 80 | OPTIONS: T_Options = { |
@@ -106,8 +108,10 @@ class T_Options(TypedDict): |
106 | 108 | "use_new_combine_kwarg_defaults": False, |
107 | 109 | "use_numbagg": True, |
108 | 110 | "use_opt_einsum": True, |
| 111 | + "facetgrid_figsize": "computed", |
109 | 112 | } |
110 | 113 |
|
| 114 | +_FACETGRID_FIGSIZE_OPTIONS = frozenset(["computed", "rcparams"]) |
111 | 115 | _JOIN_OPTIONS = frozenset(["inner", "outer", "left", "right", "exact"]) |
112 | 116 | _DISPLAY_OPTIONS = frozenset(["text", "html"]) |
113 | 117 | _NETCDF_ENGINES = frozenset(["netcdf4", "h5netcdf", "scipy"]) |
@@ -144,6 +148,7 @@ def _positive_integer(value: Any) -> bool: |
144 | 148 | "use_opt_einsum": lambda value: isinstance(value, bool), |
145 | 149 | "use_flox": lambda value: isinstance(value, bool), |
146 | 150 | "warn_for_unclosed_files": lambda value: isinstance(value, bool), |
| 151 | + "facetgrid_figsize": _FACETGRID_FIGSIZE_OPTIONS.__contains__, |
147 | 152 | } |
148 | 153 |
|
149 | 154 |
|
@@ -222,6 +227,14 @@ class set_options: |
222 | 227 | chunk_manager : str, default: "dask" |
223 | 228 | Chunk manager to use for chunked array computations when multiple |
224 | 229 | options are installed. |
| 230 | + facetgrid_figsize : {"computed", "rcparams"}, default: "computed" |
| 231 | + How :class:`~xarray.plot.FacetGrid` determines figure size when |
| 232 | + ``figsize`` is not explicitly passed: |
| 233 | +
|
| 234 | + * ``"computed"`` : figure size is derived from ``size`` and ``aspect`` |
| 235 | + parameters (current default behavior). |
| 236 | + * ``"rcparams"`` : use ``matplotlib.rcParams['figure.figsize']`` as the |
| 237 | + total figure size. |
225 | 238 | cmap_divergent : str or matplotlib.colors.Colormap, default: "RdBu_r" |
226 | 239 | Colormap to use for divergent data plots. If string, must be |
227 | 240 | matplotlib built-in colormap. Can also be a Colormap object |
@@ -357,6 +370,8 @@ def __init__(self, **kwargs): |
357 | 370 | expected = f"Expected one of {_JOIN_OPTIONS!r}" |
358 | 371 | elif k == "display_style": |
359 | 372 | expected = f"Expected one of {_DISPLAY_OPTIONS!r}" |
| 373 | + elif k == "facetgrid_figsize": |
| 374 | + expected = f"Expected one of {_FACETGRID_FIGSIZE_OPTIONS!r}" |
360 | 375 | elif k == "netcdf_engine_order": |
361 | 376 | expected = f"Expected a subset of {sorted(_NETCDF_ENGINES)}" |
362 | 377 | else: |
|
0 commit comments