diff --git a/holoviews/plotting/bokeh/chart.py b/holoviews/plotting/bokeh/chart.py index 3dbdf7729d..1dfdd9a973 100644 --- a/holoviews/plotting/bokeh/chart.py +++ b/holoviews/plotting/bokeh/chart.py @@ -270,8 +270,9 @@ def get_batched_data(self, overlay, ranges=None, empty=False): data[sanitized].append([k]) data = {opt: vals for opt, vals in data.items() if not any(v is None for v in vals)} - return data, dict(xs=elmapping['x'], ys=elmapping['y'], - **{o: o for o in opts if o in data}) + mapping = {{'x': 'xs', 'y': 'ys'}.get(k, k): v + for k, v in elmapping.items()} + return data, mapping class AreaPlot(PolygonPlot): diff --git a/holoviews/plotting/bokeh/path.py b/holoviews/plotting/bokeh/path.py index cd52c21cc5..b6cfa6102a 100644 --- a/holoviews/plotting/bokeh/path.py +++ b/holoviews/plotting/bokeh/path.py @@ -50,7 +50,8 @@ def get_batched_data(self, element, ranges=None, empty=False): # Apply static styles style = styles[zorder] expand_batched_style(style, self._batched_style_opts, - data, elmapping) + data, elmapping, path=True) + return data, elmapping @@ -110,7 +111,6 @@ def get_batched_data(self, element, ranges=None, empty=False): # Apply static styles style = styles[zorder] expand_batched_style(style, self._batched_style_opts, - data, elmapping) - + data, elmapping, path=True) return data, elmapping diff --git a/holoviews/plotting/bokeh/util.py b/holoviews/plotting/bokeh/util.py index 1ea4b142ce..f326fb1ab2 100644 --- a/holoviews/plotting/bokeh/util.py +++ b/holoviews/plotting/bokeh/util.py @@ -549,13 +549,15 @@ def get_tab_title(key, frame, overlay): return title -def expand_batched_style(style, opts, data, mapping): +def expand_batched_style(style, opts, data, mapping, path=False): """ Expands styles applied to a batched plot by iterating over the supplied list of style options and any options found in the supplied - style dictionary to the ColumnDataSource data and mapping. + style dictionary to the ColumnDataSource data and mapping. Supply + path=True to avoid nesting style options as required by multi_line + and patches glyphs. """ - nvals = len(list(data.values()[0])[-1]) + nvals = int(path) or len(list(data.values()[0])[-1]) for opt in opts: if 'color' in opt: alias = 'color' @@ -583,4 +585,4 @@ def expand_batched_style(style, opts, data, mapping): mapping[opt] = {'field': opt} if 'color' in opt and isinstance(val, tuple): val = rgb2hex(val) - data[opt].append([val]*nvals) + data[opt].append(val if path else [val]*nvals)