Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Facetgrid #83

Draft
wants to merge 18 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 15 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion cf_xarray/accessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
xr.core.rolling.Rolling,
xr.core.rolling.Coarsen,
xr.core.weighted.Weighted,
xr.plot.facetgrid.FacetGrid,
)

#: `axis` names understood by cf_xarray
Expand Down Expand Up @@ -459,7 +460,7 @@ def _getattr(
attr: str,
accessor: "CFAccessor",
key_mappers: Mapping[str, Mapper],
wrap_classes: bool = False,
wrap_classes: bool = True,
extra_decorator: Callable = None,
):
"""
Expand Down
14 changes: 0 additions & 14 deletions cf_xarray/tests/test_accessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,24 +294,10 @@ def test_dataarray_plot(obj):
assert isinstance(rv, mpl.contour.QuadContourSet)
plt.close()

rv = obj.cf.plot(x="X", y="Y", col="T")
assert isinstance(rv, xr.plot.FacetGrid)
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")
assert all([isinstance(line, mpl.lines.Line2D) for line in rv])
plt.close()

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)
dcherian marked this conversation as resolved.
Show resolved Hide resolved
plt.close()


@pytest.mark.parametrize("obj", datasets)
def test_dataset_plot(obj):
Expand Down