Skip to content

Commit

Permalink
Update test_plot.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Illviljan committed Apr 7, 2024
1 parent 422b8da commit 0b16cf9
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions xarray/tests/test_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -3344,24 +3344,30 @@ def test_plot1d_functions(
plotfunc: str,
) -> None:
"""Test plot1d function. Merge with TestPlot1D eventually."""
ds = xr.tutorial.scatter_example_dataset()
import matplotlib.pyplot as plt

ds = xr.tutorial.scatter_example_dataset(seed=42)

extra_coords = [v for v in [x, hue, _size] if v is not None]
# extra_coords = [v for v in [x, hue, _size] if v is not None]

# Base coords:
coords = dict(ds.coords)
# # Base coords:
# coords = dict(ds.coords)

# Add extra coords to the DataArray:
coords.update({v: ds[v] for v in extra_coords})
# # Add extra coords to the DataArray:
# coords.update({v: ds[v] for v in extra_coords})

darray = xr.DataArray(ds[y], coords=coords)
# darray = xr.DataArray(ds[y], coords=coords)

with figure_context():
getattr(darray.plot, plotfunc)(
# plt.close("all")
getattr(ds.plot, plotfunc)(
x=x,
y=y,
z=z,
hue=hue,
_size=_size,
row=row,
col=col,
add_legend=add_legend,
add_colorbar=add_colorbar,
)
Expand Down

0 comments on commit 0b16cf9

Please sign in to comment.