MCPcopy
hub / github.com/pydata/xarray / _easy_facetgrid

Function _easy_facetgrid

xarray/plot/facetgrid.py:1064–1127  ·  view source on GitHub ↗

Convenience method to call xarray.plot.FacetGrid from 2d plotting methods kwargs are the arguments to 2d plotting method

(
    data: T_DataArrayOrSet,
    plotfunc: Callable,
    kind: Literal["line", "dataarray", "dataset", "plot1d"],
    x: Hashable | None = None,
    y: Hashable | None = None,
    row: Hashable | None = None,
    col: Hashable | None = None,
    col_wrap: int | None = None,
    sharex: bool = True,
    sharey: bool = True,
    aspect: float | None = None,
    size: float | None = None,
    subplot_kws: dict[str, Any] | None = None,
    ax: Axes | None = None,
    figsize: Iterable[float] | None = None,
    **kwargs: Any,
)

Source from the content-addressed store, hash-verified

1062
1063
1064def _easy_facetgrid(
1065 data: T_DataArrayOrSet,
1066 plotfunc: Callable,
1067 kind: Literal["line", "dataarray", "dataset", "plot1d"],
1068 x: Hashable | None = None,
1069 y: Hashable | None = None,
1070 row: Hashable | None = None,
1071 col: Hashable | None = None,
1072 col_wrap: int | None = None,
1073 sharex: bool = True,
1074 sharey: bool = True,
1075 aspect: float | None = None,
1076 size: float | None = None,
1077 subplot_kws: dict[str, Any] | None = None,
1078 ax: Axes | None = None,
1079 figsize: Iterable[float] | None = None,
1080 **kwargs: Any,
1081) -> FacetGrid[T_DataArrayOrSet]:
1082 """
1083 Convenience method to call xarray.plot.FacetGrid from 2d plotting methods
1084
1085 kwargs are the arguments to 2d plotting method
1086 """
1087 if ax is not None:
1088 raise ValueError("Can't use axes when making faceted plots.")
1089 if aspect is None:
1090 aspect = 1
1091 if size is None:
1092 size = 3
1093 elif figsize is not None:
1094 raise ValueError("cannot provide both `figsize` and `size` arguments")
1095 if kwargs.get("z") is not None:
1096 # 3d plots doesn't support sharex, sharey, reset to mpl defaults:
1097 sharex = False
1098 sharey = False
1099
1100 g = FacetGrid(
1101 data=data,
1102 col=col,
1103 row=row,
1104 col_wrap=col_wrap,
1105 sharex=sharex,
1106 sharey=sharey,
1107 figsize=figsize,
1108 aspect=aspect,
1109 size=size,
1110 subplot_kws=subplot_kws,
1111 )
1112
1113 if kind == "line":
1114 return g.map_dataarray_line(plotfunc, x, y, **kwargs)
1115
1116 if kind == "dataarray":
1117 return g.map_dataarray(plotfunc, x, y, **kwargs)
1118
1119 if kind == "plot1d":
1120 return g.map_plot1d(plotfunc, x, y, **kwargs)
1121

Callers 3

newplotfuncFunction · 0.90
lineFunction · 0.90
newplotfuncFunction · 0.90

Calls 6

map_dataarray_lineMethod · 0.95
map_dataarrayMethod · 0.95
map_plot1dMethod · 0.95
map_datasetMethod · 0.95
FacetGridClass · 0.85
getMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…