i am using holoviews with following bokeh version
In [2]: bokeh.version
Out[2]: ‘2.0.2’
Following are the code :-
import pandas as pd
import holoviews as hv
from holoviews.selection import link_selections
import panel as pn
import param
hv.extension('bokeh')
COLOR = "#6dcfcd"
data = {"x": [1,2,3,4,5], "y": [2,4,5,7,10], "info": ["Holoviews", "and", "Panel", "are", "awesome"]}
df = pd.DataFrame(data)
dataset = hv.Dataset(df)
scatter = hv.Scatter(dataset, "x", "y").opts(color=COLOR, width=450, size=25, default_tools=[], tools=['box_select'])
bars = hv.Bars(dataset, "x", "y").opts(color=COLOR, width=450, alpha=0.5, line_width=0, default_tools=[], tools=['box_select'],)
link = link_selections.instance()
plots = link(scatter+bars)
bar = pn.Row(pn.pane.Markdown("# Panel and Holoviews - Linked Plots and Tables", sizing_mode="stretch_width"), sizing_mode="stretch_width", background=COLOR)
@param.depends(link.param.selection_expr)
def selection_table(_):
return hv.Table(dataset.select(link.selection_expr)).opts(width=900, height=200)
app = pn.Column(bar, plots, selection_table, height=600)
app
error Results:-
> > ---------------------------------------------------------------------------
> > ValueError Traceback (most recent call last)
> > e:\Anaconda\lib\site-packages\IPython\core\formatters.py in __call__(self, obj, include, exclude)
> > 968
> > 969 if method is not None:
> > --> 970 return method(include=include, exclude=exclude)
> > 971 return None
> > 972 else:
> >
> > e:\Anaconda\lib\site-packages\panel\viewable.py in _repr_mimebundle_(self, include, exclude)
> > 521 doc = _Document()
> > 522 comm = state._comm_manager.get_server_comm()
> > --> 523 model = self._render_model(doc, comm)
> > 524 ref = model.ref['id']
> > 525 manager = CommManager(comm_id=comm.id, plot_id=ref)
> >
> > e:\Anaconda\lib\site-packages\panel\viewable.py in _render_model(self, doc, comm)
> > 417 if comm is None:
> > 418 comm = state._comm_manager.get_server_comm()
> > --> 419 model = self.get_root(doc, comm)
> > 420
> > 421 if config.embed:
> >
> > e:\Anaconda\lib\site-packages\panel\viewable.py in get_root(self, doc, comm)
> > 450 """
> > 451 doc = doc or _curdoc()
> > --> 452 root = self._get_model(doc, comm=comm)
> > 453 self._preprocess(root)
> > 454 ref = root.ref['id']
> >
> > e:\Anaconda\lib\site-packages\panel\layout\base.py in _get_model(self, doc, root, parent, comm)
> > 110 if root is None:
> > 111 root = model
> > --> 112 objects = self._get_objects(model, [], doc, root, comm)
> > 113 props = dict(self._init_properties(), objects=objects)
> > 114 model.update(**self._process_param_change(props))
> >
> > e:\Anaconda\lib\site-packages\panel\layout\base.py in _get_objects(self, model, old_objects, doc, root, comm)
> > 100 else:
> > 101 try:
> > --> 102 child = pane._get_model(doc, root, model, comm)
> > 103 except RerenderError:
> > 104 return self._get_objects(model, current_objects[:i], doc, root, comm)
> >
> > e:\Anaconda\lib\site-packages\panel\pane\holoviews.py in _get_model(self, doc, root, parent, comm)
> > 225 plot = self.object
> > 226 else:
> > --> 227 plot = self._render(doc, comm, root)
> > 228
> > 229 plot.pane = self
> >
> > e:\Anaconda\lib\site-packages\panel\pane\holoviews.py in _render(self, doc, comm, root)
> > 284 kwargs = {}
> > 285
> > --> 286 return renderer.get_plot(self.object, **kwargs)
> > 287
> > 288 def _cleanup(self, root):
> >
> > e:\Anaconda\lib\site-packages\holoviews\plotting\bokeh\renderer.py in get_plot(self_or_cls, obj, doc, renderer, **kwargs)
> > 71 combining the bokeh model with another plot.
> > 72 """
> > ---> 73 plot = super(BokehRenderer, self_or_cls).get_plot(obj, doc, renderer, **kwargs)
> > 74 if plot.document is None:
> > 75 plot.document = Document() if self_or_cls.notebook_context else curdoc()
> >
> > e:\Anaconda\lib\site-packages\holoviews\plotting\renderer.py in get_plot(self_or_cls, obj, doc, renderer, comm, **kwargs)
> > 238 init_key = tuple(v if d is None else d for v, d in
> > 239 zip(plot.keys[0], defaults))
> > --> 240 plot.update(init_key)
> > 241 else:
> > 242 plot = obj
> >
> > e:\Anaconda\lib\site-packages\holoviews\plotting\plot.py in update(self, key)
> > 924 def update(self, key):
> > 925 if len(self) == 1 and ((key == 0) or (key == self.keys[0])) and not self.drawn:
> > --> 926 return self.initialize_plot()
> > 927 item = self.__getitem__(key)
> > 928 self.traverse(lambda x: setattr(x, '_updated', True))
> >
> > e:\Anaconda\lib\site-packages\holoviews\plotting\bokeh\plot.py in initialize_plot(self, plots, ranges)
> > 907
> > 908 shared_plots = list(passed_plots) if self.shared_axes else None
> > --> 909 subplots = subplot.initialize_plot(ranges=ranges, plots=shared_plots)
> > 910 nsubplots = len(subplots)
> > 911
> >
> > e:\Anaconda\lib\site-packages\holoviews\plotting\bokeh\plot.py in initialize_plot(self, ranges, plots)
> > 1051 else:
> > 1052 passed_plots = plots + adjoined_plots
> > -> 1053 adjoined_plots.append(subplot.initialize_plot(ranges=ranges, plots=passed_plots))
> > 1054 self.drawn = True
> > 1055 if not adjoined_plots: adjoined_plots = [None]
> >
> > e:\Anaconda\lib\site-packages\holoviews\plotting\bokeh\element.py in initialize_plot(self, ranges, plot, plots)
> > 2271 for k, v in list(self.handles.items()):
> > 2272 if not k.endswith('color_mapper'):
> > -> 2273 continue
> > 2274 self._draw_colorbar(plot, v, k[:-12])
> > 2275 return ret
> >
> > e:\Anaconda\lib\site-packages\holoviews\plotting\bokeh\element.py in _init_plot(self, key, element, plots, ranges)
> > 496 if len(ydims) > 1 or y_range_type is FactorRange:
> > 497 y_axis_type = 'auto'
> > --> 498 categorical_y = True
> > 499 else:
> > 500 if isinstance(el, Graph):
> >
> > e:\Anaconda\lib\site-packages\holoviews\plotting\bokeh\element.py in _init_tools(self, element, callbacks)
> > 2195
> > 2196 if factors is None and (isinstance(cdata, list)
> > -> 2197 or cdata.dtype.kind in dtypes):
> > 2198 range_key = dim_range_key(cdim)
> > 2199 if range_key in ranges and 'factors' in ranges[range_key]:
> >
> > e:\Anaconda\lib\site-packages\holoviews\plotting\bokeh\element.py in _init_tools(self, element, callbacks)
> > 287 **hover_opts)
> > 288 hover = tool
> > --> 289 else:
> > 290 tool = TOOLS_MAP[handle]()
> > 291 cb_tools.append(tool)
> >
> > e:\Anaconda\lib\site-packages\bokeh\model.py in js_link(self, attr, other, other_attr, attr_selector)
> > 443
> > 444 .. code :: python
> > --> 445
> > 446 range_slider.js_link('value', plot.x_range, 'start', attr_selector=0)
> > 447
> >
> > **ValueError: 'mode' is not a property of self (BoxSelectTool(id='15734', ...))**
> >
> > Column(height=600)
> > [0] Row(background='#6dcfcd', sizing_mode='stretch_width')
> > [0] Markdown(str, sizing_mode='stretch_width')
> > [1] HoloViews(Layout)
> > [2] ParamFunction(function)