From 6af7e8d919cabcb713cc3befd46b043fd60a91ae Mon Sep 17 00:00:00 2001
From: Philipp Rudiger
Date: Mon, 17 Sep 2018 18:22:13 +0100
Subject: [PATCH] Fix for bokeh PathPlot
---
holoviews/plotting/bokeh/path.py | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/holoviews/plotting/bokeh/path.py b/holoviews/plotting/bokeh/path.py
index a33c755198..590a291176 100644
--- a/holoviews/plotting/bokeh/path.py
+++ b/holoviews/plotting/bokeh/path.py
@@ -48,7 +48,6 @@ def _get_hover_data(self, data, element):
def get_data(self, element, ranges, style):
cdim = element.get_dimension(self.color_index)
- if cdim: cidx = element.get_dimension_index(cdim)
inds = (1, 0) if self.invert_axes else (0, 1)
mapping = dict(self._mapping)
if not cdim:
@@ -62,7 +61,8 @@ def get_data(self, element, ranges, style):
dim_name = util.dimension_sanitizer(cdim.name)
if not self.static_source:
- paths, vals = [], defaultdict(list)
+ paths = []
+ vals = {util.dimension_sanitizer(vd.name): [] for vd in element.vdims}
for path in element.split():
cvals = path.dimension_values(cdim)
splits = [0]+list(np.where(np.diff(cvals)!=0)[0]+1)
@@ -72,9 +72,12 @@ def get_data(self, element, ranges, style):
for i, vd in enumerate(element.vdims):
path_val = path.iloc[s1, i+2]
vd_column = util.dimension_sanitizer(vd.name)
+ dt_column = vd_column+'_dt_strings'
vals[vd_column].append(path_val)
if isinstance(path_val, util.datetime_types):
- vals[vd_column+'_dt_strings'].append(vd.pprint_value(path_val))
+ if dt_column not in vals:
+ vals[dt_column] = []
+ vals[dt_column].append(vd.pprint_value(path_val))
paths.append(path.iloc[s1:s2+1, :2].array())
xs, ys = ([path[:, idx] for path in paths] for idx in inds)
data = dict(xs=xs, ys=ys, **{d: np.array(vs) for d, vs in vals.items()})