diff --git a/xarray/plot/dataset_plot.py b/xarray/plot/dataset_plot.py index 37bdcbac94e..ff508ee213c 100644 --- a/xarray/plot/dataset_plot.py +++ b/xarray/plot/dataset_plot.py @@ -630,6 +630,8 @@ def streamplot( cmap_params = kwargs.pop("cmap_params") if hue: + if xdim is not None and ydim is not None: + ds[hue] = ds[hue].transpose(ydim, xdim) kwargs["color"] = ds[hue].values # TODO: Fix this by always returning a norm with vmin, vmax in cmap_params diff --git a/xarray/tests/test_plot.py b/xarray/tests/test_plot.py index 3c7d83d2825..c2db5d6b620 100644 --- a/xarray/tests/test_plot.py +++ b/xarray/tests/test_plot.py @@ -2698,9 +2698,9 @@ class TestDatasetStreamplotPlots(PlotTestCase): def setUp(self) -> None: das = [ DataArray( - np.random.randn(3, 3, 2, 2), + np.random.randn(3, 4, 2, 2), dims=["x", "y", "row", "col"], - coords=[range(k) for k in [3, 3, 2, 2]], + coords=[range(k) for k in [3, 4, 2, 2]], ) for _ in [1, 2] ]
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: