holoviz / holoviz/hvplot

Plot not returning when specify x/y in axis_arguments for chunked NetCDF

Open
#1,325 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
1.4k
Forks
124
Avg merge
1d 18h
Merged PRs (30d)
1

Description

Thanks for contacting us! Please read and follow these instructions carefully, then delete this introductory text to keep your issue easy to read. Note that the issue tracker is NOT the place for usage questions and technical assistance; post those at [Discourse](https://discourse.holoviz.org) instead. Issues without the required information below may be closed immediately.

#### ALL software version info

- xarray
```
'2023.12.0'
```
- holoviews
```
'1.18.1'
```

#### Description of expected behavior and the observed behavior

When setting the `x` or `y` values in the arguments for `hvplot.line` the code hangs and never return

#### Complete, minimal, self-contained example code that reproduces the issue

```python
import xarray as xr
import holoviews as hv
import hvplot.xarray

hv.renderer('bokeh').webgl = False

test_url = "https://thredds.met.no/thredds/dodsC/met.no/observations/stations/SN99880.nc"
ds = xr.open_dataset(test_url)
var = 'air_temperature_2m'

# the following works:
axis_arguments = {'grid':True, 'title': 'title', 'widget_location': 'bottom', 'responsive': False}
ds[var].hvplot.line(**axis_arguments)

# When trying to set `x` or `y` values in the `**axis_arguments` for `hvplot.line` the code hangs and never return

axis_arguments = {'y': ds[var], 'grid':True, 'title': 'title', 'widget_location': 'bottom', 'responsive': False}
ds[var].hvplot.line(**axis_arguments)

# same for:

axis_arguments = {'x': ds[var], 'grid':True, 'title': 'title', 'widget_location': 'bottom', 'responsive': False}
ds[var].hvplot.line(**axis_arguments)
```

#### Stack traceback and/or browser JavaScript console output

```
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Cell In[24], line 1
----> 1 ds[var].hvplot.line(**axis_arguments)

File /opt/conda/lib/python3.11/site-packages/hvplot/plotting/core.py:370, in hvPlotTabular.line(self, x, y, **kwds)
275 def line(self, x=None, y=None, **kwds):
276 """
277 The `line` plot connects the points with a continuous curve.
278
(...)
368 - Wiki: https://en.wikipedia.org/wiki/Line_chart
369 """
--> 370 return self(x, y, kind="line", **kwds)

File /opt/conda/lib/python3.11/site-packages/hvplot/plotting/core.py:93, in hvPlotBase.__call__(self, x, y, kind, **kwds)
91 return pn.panel(callback)
92 if panel_dict:
---> 93 plot = self._get_converter(x, y, kind, **kwds)(kind, x, y)
94 return pn.panel(plot, **panel_dict)
96 return self._get_converter(x, y, kind, **kwds)(kind, x, y)

File /opt/conda/lib/python3.11/site-packages/hvplot/plotting/core.py:103, in hvPlotBase._get_converter(self, x, y, kind, **kwds)
101 y = y or params.pop("y", None)
102 kind = kind or params.pop("kind", None)
--> 103 return HoloViewsConverter(self._data, x, y, kind=kind, **params)

File /opt/conda/lib/python3.11/site-packages/hvplot/converter.py:405, in HoloViewsConverter.__init__(self, data, x, y, kind, by, use_index, group_label, value_label, backlog, persist, use_dask, crs, fields, groupby, dynamic, grid, legend, rot, title, xlim, ylim, clim, symmetric, logx, logy, loglog, hover, subplots, label, invert, stacked, colorbar, datashade, rasterize, downsample, resample_when, row, col, debug, framewise, aggregator, projection, global_extent, geo, precompute, flip_xaxis, flip_yaxis, dynspread, hover_cols, x_sampling, y_sampling, project, tools, attr_labels, coastline, tiles, sort_date, check_symmetric_max, transforms, stream, cnorm, features, rescale_discrete_levels, autorange, **kwds)
403 self.value_label = value_label
404 self.label = label
--> 405 self._process_data(
406 kind, data, x, y, by, groupby, row, col, use_dask,
407 persist, backlog, label, group_label, value_label,
408 hover_cols, attr_labels, transforms, stream, kwds
409 )
411 self.dynamic = dynamic
412 self.geo = any([geo, crs, global_extent, projection, project, coastline, features])

File /opt/conda/lib/python3.11/site-packages/hvplot/converter.py:819, in HoloViewsConverter._process_data(self, kind, data, x, y, by, groupby, row, col, use_dask, persist, backlog, label, group_label, value_label, hover_cols, attr_labels, transforms, stream, kwds)
817 other_dims = []
818 da = data
--> 819 data, x, y, by_new, groupby_new = process_xarray(
820 data, x, y, by, groupby, use_dask, persist, gridded,
821 label, value_label, other_dims, kind=kind)
823 if kind not in self._stats_types:
824 if by is None: by = by_new

File /opt/conda/lib/python3.11/site-packages/hvplot/util.py:480, in process_xarray(data, x, y, by, groupby, use_dask, persist, gridded, label, value_label, other_dims, kind)
478 covered_dims = []
479 for var in all_vars:
--> 480 if var in dataset.coords:
481 covered_dims.extend(dataset[var].dims)
482 leftover_dims = [dim for dim in index_dims
483 if dim not in covered_dims + all_vars]

File /opt/conda/lib/python3.11/site-packages/xarray/core/coordinates.py:104, in AbstractCoordinates.__contains__(self, key)
103 def __contains__(self, key: Hashable) -> bool:
--> 104 return key in self._names

TypeError: unhashable type: 'DataArray'
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.