Skip to content

Commit

Permalink
Set default col and groupby kwargs (#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
aazuspan committed Oct 18, 2022
1 parent f171265 commit 06d509c
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions wxee/xarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,17 +87,19 @@ def rgb(
except ImportError:
raise ImportError(
"The `hvplot` package is required for interactive plots. Run `pip install hvplot`."
)

default_kwargs = {"widget_location": "bottom", "widget_type": "scrubber"}

for k, v in default_kwargs.items():
if k not in kwargs:
kwargs[k] = v

return da.hvplot.rgb(x="x", y="y", bands="variable", **kwargs)

return da.plot.imshow(col="time", **kwargs)
) from None

default_kwargs = {
"groupby": "time",
"widget_location": "bottom",
"widget_type": "scrubber",
}
return da.hvplot.rgb(
x="x", y="y", bands="variable", **{**default_kwargs, **kwargs}
)

default_kwargs = {"col": "time"}
return da.plot.imshow(**{**default_kwargs, **kwargs})


@xr.register_dataarray_accessor("wx")
Expand Down

0 comments on commit 06d509c

Please sign in to comment.