From 2e60a4f6751c15909f99694d39fd762c9c7436d3 Mon Sep 17 00:00:00 2001 From: "S. Cao (DL-desktop)" Date: Tue, 10 Jun 2025 22:47:21 -0500 Subject: [PATCH 1/2] fixed color.shape != grid.shape in streamplot when nx != ny --- xarray/plot/dataset_plot.py | 2 ++ 1 file changed, 2 insertions(+) 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 From 145d2ad1b03478d7b0479629e14fee0fcabfbd9b Mon Sep 17 00:00:00 2001 From: "S. Cao (DL-desktop)" Date: Thu, 12 Jun 2025 10:26:14 -0500 Subject: [PATCH 2/2] update StreamplotPlots test when nx!=ny --- xarray/tests/test_plot.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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] ] pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

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:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy