holoviz / holoviz/hvplot

Specifying `widgets` or `widget_location` changes return type from holoviews to panel

Open
#519 9 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

#### ALL software version info
hvplot 0.6
holoviews 1.13.5
bokeh 2.2.3

#### Description of expected behavior and the observed behavior
using default widgets seems to return a `holoviews.core.spaces.DynamicMap`, but specifying keywords `widget_location` or `widgets` returns `panel.layout.base.Column` (or Row). This leads to confusing errors when trying to compose elements or link streams. I imagine there are workarounds to get at the DynamicMap embedded within the panel layout, but I'm having trouble figuring it out.

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

```python
#minimal reproducible example
import xarray as xr
import hvplot.xarray
import holoviews as hv
from holoviews.streams import RangeXY

air_ds = xr.tutorial.open_dataset('air_temperature').load()
air = air_ds.air
print(type(air.hvplot.image()))
print(type(air.hvplot.image(widget_location='bottom')))
#
#
```

##### bug1 composing elements
```python
img = air.hvplot.image(widget_location='bottom')
point = hv.Points([(260, 40)])
img * point
```

```pytb
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
in
2 img = air.hvplot.image(widget_location='bottom')
3 point = hv.Points([(260, 40)])
----> 4 img * point

TypeError: unsupported operand type(s) for *: 'Column' and 'Points'
```

##### bug2 adding a stream
```python
# bug 2 adding stream
img = air.hvplot.image(widget_location='bottom')
range_xy_stream = RangeXY(source=img)
img
```

```pytb
/srv/conda/envs/notebook/lib/python3.8/site-packages/holoviews/plotting/plot.py in (.0)
953 streams = [
954 s for src, streams in registry for s in streams
--> 955 if src is source or (src._plot_id is not None and
956 src._plot_id == source._plot_id)]
957 cb_classes |= {(callbacks[type(stream)], stream) for stream in streams

AttributeError: 'Column' object has no attribute '_plot_id'
```

@jbednar or @philippjfr , it would be great to have an example of how to work around these issues by accessing the DynamicMap wrapped in panel.

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.