Skip to content

Commit 17ab7b3

Browse files
authored
extend show to display Panel objects (#1230)
1 parent 89dd0c0 commit 17ab7b3

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

hvplot/utilities.py

+8-5
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@
1010

1111
def show(obj, title=None, port=0, **kwargs):
1212
"""
13-
Displays HoloViews objects in and outside the notebook
13+
Displays hvplot plots in and outside the notebook
1414
1515
Parameters
1616
----------
17-
obj : HoloViews object
18-
HoloViews object to export
17+
obj : HoloViews/Panel object
18+
HoloViews/Panel object to show
1919
title : str
2020
A string title to give the Document (if served as an app)
2121
port: int (optional, default=0)
@@ -26,10 +26,13 @@ def show(obj, title=None, port=0, **kwargs):
2626
-------
2727
a panel.io.server.Server | panel.io.server.StoppableThread (if threaded=true)
2828
"""
29-
if not isinstance(obj, _hv.core.Dimensioned):
29+
if isinstance(obj, _hv.core.Dimensioned):
30+
return _pn.pane.HoloViews(obj).show(title, port, **kwargs)
31+
elif isinstance(obj, _pn.viewable.Viewable):
32+
return obj.show(title, port, **kwargs)
33+
else:
3034
raise ValueError('%s type object not recognized and cannot be shown.' %
3135
type(obj).__name__)
32-
return _pn.pane.HoloViews(obj).show(title, port, **kwargs)
3336

3437

3538
class hvplot_extension(_hv.extension):

0 commit comments

Comments
 (0)