diff --git a/cf_xarray/accessor.py b/cf_xarray/accessor.py index b8efa011..ff0f5c4a 100644 --- a/cf_xarray/accessor.py +++ b/cf_xarray/accessor.py @@ -40,6 +40,7 @@ xr.core.rolling.Rolling, xr.core.rolling.Coarsen, xr.core.weighted.Weighted, + xr.plot.facetgrid.FacetGrid, ) #: `axis` names understood by cf_xarray @@ -447,7 +448,7 @@ def _getattr( attr: str, accessor: "CFAccessor", key_mappers: Mapping[str, Mapper], - wrap_classes: bool = False, + wrap_classes: bool = True, extra_decorator: Callable = None, ): """ diff --git a/cf_xarray/tests/test_accessor.py b/cf_xarray/tests/test_accessor.py index 47e5d03e..eb37b1b1 100644 --- a/cf_xarray/tests/test_accessor.py +++ b/cf_xarray/tests/test_accessor.py @@ -447,11 +447,10 @@ def test_dataarray_plot(): plt.close() rv = obj.cf.plot(x="X", y="Y", col="T") - assert isinstance(rv, xr.plot.FacetGrid) + rv.map_dataarray(xr.plot.contourf, x="X", y="Y", col="T") plt.close() rv = obj.cf.plot.contourf(x="X", y="Y", col="T") - assert isinstance(rv, xr.plot.FacetGrid) plt.close() rv = obj.isel(lat=[0, 1], lon=1).cf.plot.line(x="T", hue="Y") @@ -488,7 +487,6 @@ def test_dataarray_plot(): obj = obj.copy(deep=True) obj.time.attrs.clear() rv = obj.cf.plot(x="X", y="Y", col="time") - assert isinstance(rv, xr.plot.FacetGrid) plt.close()