From cd2810d91f01120038027919b13e4eced38be81a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20H=C3=B8xbro=20Hansen?= Date: Tue, 6 Jun 2023 20:29:33 +0200 Subject: [PATCH 1/3] Try to work with not gridded data --- hvplot/converter.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/hvplot/converter.py b/hvplot/converter.py index 3c2e72eef..64706e68a 100644 --- a/hvplot/converter.py +++ b/hvplot/converter.py @@ -754,7 +754,9 @@ def _process_data(self, kind, data, x, y, by, groupby, row, col, raise ValueError("Cannot plot an empty xarray.Dataset object.") if z is None: if isinstance(data, xr.Dataset): - z = list(data.data_vars)[0] + z = [k for k in data.data_vars if k not in (x, y)] + if len(z) > 0: + z = z[0] else: z = data.name or label or value_label if gridded and isinstance(data, xr.Dataset) and not isinstance(z, list): @@ -1236,7 +1238,9 @@ def method_wrapper(ds, x, y): elif self.datatype == 'xarray': import xarray as xr if isinstance(data, xr.Dataset): - dataset = Dataset(data, self.indexes) + kdims = self.indexes + vdims = [vd for vd in data.data_vars.variables if vd not in kdims] + dataset = Dataset(data, kdims=kdims, vdims=vdims) else: name = data.name or self.label or self.value_label dataset = Dataset(data, self.indexes, name) @@ -2241,7 +2245,7 @@ def _geom_plot(self, x=None, y=None, data=None, kind='polygons'): redim = self._merge_redim({self._color_dim: self._dim_ranges['c']} if self._color_dim else {}) kdims, vdims = self._get_dimensions([x, y], []) if self.gridded_data: - vdims = Dataset(data).vdims + vdims = [vd for vd in Dataset(data).vdims if vd not in kdims] element = self._get_element(kind) cur_opts, compat_opts = self._get_compat_opts(element.name) for opts_ in [cur_opts, compat_opts]: From 5448e9db4d8059badd9a3e77805726ba44c6c470 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20H=C3=B8xbro=20Hansen?= Date: Tue, 6 Jun 2023 20:35:38 +0200 Subject: [PATCH 2/3] Add custom branch --- .github/workflows/test.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index bf0cb8dec..387912fb4 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -111,6 +111,11 @@ jobs: # - Install importlib_resources to fix tqdm that missed adding it as a dependency # for 3.6 (https://github.com/conda-forge/tqdm-feedstock/pull/114) conda install "panel=0.12" "importlib_resources" --no-update-deps + - name: Add Holoviews branch + run: | + conda activate test-environment + conda uninstall holoviews -y --offline --force || echo already uninstalled + pip install "git+https://github.com/holoviz/holoviews.git@xarray_improve" - name: doit env_capture run: | conda activate test-environment From 234d7275b49772c6e570f07d9ccb2cb883d2183e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20H=C3=B8xbro=20Hansen?= Date: Tue, 6 Jun 2023 20:59:28 +0200 Subject: [PATCH 3/3] Move custom install and ignore macos+3.7 --- .github/workflows/test.yaml | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 387912fb4..5b7a2ff43 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -40,6 +40,9 @@ jobs: os: ['ubuntu-latest', 'macos-latest', 'windows-latest'] # Run on the full set on schedule, workflow_dispatch and push&tags events, otherwise on a subset. python-version: ${{ ( github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || ( github.event_name == 'push' && github.ref_type == 'tag' ) ) && fromJSON('["3.7", "3.8", "3.9", "3.10", "3.11"]') || fromJSON('["3.7", "3.9", "3.11"]') }} + exclude: + - os: macos-latest + python-version: 3.7 timeout-minutes: 90 defaults: run: @@ -56,11 +59,11 @@ jobs: conda-update: true conda-mamba: mamba id: install - - name: patch fiona/geostack on Python 3.7 / Macos - if: steps.install.outputs.cache-hit != 'true' && contains(matrix.os, 'macos') && matrix.python-version == '3.7' + - name: Add Holoviews branch run: | conda activate test-environment - mamba install "fiona=1.8" "gdal=3.3" + conda uninstall holoviews -y --offline --force || echo already uninstalled + pip install "git+https://github.com/holoviz/holoviews.git@xarray_improve" - name: doit test_unit run: | conda activate test-environment @@ -111,11 +114,6 @@ jobs: # - Install importlib_resources to fix tqdm that missed adding it as a dependency # for 3.6 (https://github.com/conda-forge/tqdm-feedstock/pull/114) conda install "panel=0.12" "importlib_resources" --no-update-deps - - name: Add Holoviews branch - run: | - conda activate test-environment - conda uninstall holoviews -y --offline --force || echo already uninstalled - pip install "git+https://github.com/holoviz/holoviews.git@xarray_improve" - name: doit env_capture run: | conda activate test-environment