diff --git a/holoviews/plotting/bokeh/chart.py b/holoviews/plotting/bokeh/chart.py index ac5a0618df..bfcfce3cb0 100644 --- a/holoviews/plotting/bokeh/chart.py +++ b/holoviews/plotting/bokeh/chart.py @@ -477,11 +477,16 @@ def get_data(self, element, ranges, style): data, mapping, style = HistogramPlot.get_data(self, element, ranges, style) color_dims = [d for d in self.adjoined.traverse(lambda x: x.handles.get('color_dim')) if d is not None] - dim = color_dims[0] if color_dims else None - cmapper = self._get_colormapper(dim, element, {}, {}) - if cmapper and dim in element.dimensions(): - data[dim.name] = [] if self.static_source else element.dimension_values(dim) - mapping['fill_color'] = {'field': dim.name, + dimension = color_dims[0] if color_dims else None + cmapper = self._get_colormapper(dimension, element, {}, {}) + if cmapper and dimension in element.dimensions(): + if isinstance(dimension, dim): + dim_name = dimension.dimension.name + data[dim_name] = [] if self.static_source else dimension.apply(element) + else: + dim_name = dimension.name + data[dim_name] = [] if self.static_source else element.dimension_values(dimension) + mapping['fill_color'] = {'field': dim_name, 'transform': cmapper} return (data, mapping, style) diff --git a/holoviews/plotting/bokeh/element.py b/holoviews/plotting/bokeh/element.py index 5914022258..36fe9c54a7 100644 --- a/holoviews/plotting/bokeh/element.py +++ b/holoviews/plotting/bokeh/element.py @@ -11,7 +11,9 @@ from bokeh.core.properties import value from bokeh.document.events import ModelChangedEvent -from bokeh.models import Renderer, Title, Legend, ColorBar, tools +from bokeh.models import ( + ColorBar, ColorMapper, Legend, Renderer, Title, tools +) from bokeh.models.axes import CategoricalAxis, DatetimeAxis from bokeh.models.formatters import ( FuncTickFormatter, TickFormatter, MercatorTickFormatter @@ -1720,12 +1722,17 @@ def _get_colormapper(self, eldim, element, ranges, style, factors=None, colors=N # Attempt to find matching colormapper on the adjoined plot if self.adjoined: - cmapper_name = dim_name+name - cmappers = self.adjoined.traverse(lambda x: (x.handles.get('color_dim'), - x.handles.get(name, x.handles.get(cmapper_name)))) - cmappers = [cmap for cdim, cmap in cmappers if cdim == eldim] + cmappers = self.adjoined.traverse( + lambda x: (x.handles.get('color_dim'), + x.handles.get(name), + [v for v in x.handles.values() + if isinstance(v, ColorMapper)]) + ) + cmappers = [(cmap, mappers) for cdim, cmap, mappers in cmappers + if cdim == eldim] if cmappers: - cmapper = cmappers[0] + cmapper, mappers = cmappers[0] + cmapper = cmapper if cmapper else mappers[0] self.handles['color_mapper'] = cmapper return cmapper else: diff --git a/holoviews/plotting/mpl/path.py b/holoviews/plotting/mpl/path.py index 43de6c1278..d145a9934f 100644 --- a/holoviews/plotting/mpl/path.py +++ b/holoviews/plotting/mpl/path.py @@ -30,7 +30,7 @@ class PathPlot(ColorbarPlot): style_opts = ['alpha', 'color', 'linestyle', 'linewidth', 'visible', 'cmap'] def get_data(self, element, ranges, style): - cdim = element.get_dimension(self.color_index or style.get('color')) + cdim = element.get_dimension(self.color_index) with abbreviated_exception(): style = self._apply_transforms(element, ranges, style) diff --git a/holoviews/plotting/plot.py b/holoviews/plotting/plot.py index 6425d7e1d1..5e159d8b5d 100644 --- a/holoviews/plotting/plot.py +++ b/holoviews/plotting/plot.py @@ -704,7 +704,7 @@ def _compute_group_range(cls, group, elements, ranges, framewise, top_level): dim_name = repr(v) if dim_name in prev_ranges and not framewise: continue - values = v.apply(el, expanded=False, all_values=True) + values = v.apply(el, all_values=True) factors = None if values.dtype.kind == 'M': drange = values.min(), values.max()