Skip to content

Commit

Permalink
Merge 1531bb1 into b4c631c
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr committed Jul 17, 2019
2 parents b4c631c + 1531bb1 commit 2d802e1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions holoviews/plotting/bokeh/element.py
Expand Up @@ -1030,12 +1030,11 @@ def _apply_transforms(self, element, data, ranges, style, group=None):
else:
factors = util.unique_array(val)
kwargs['factors'] = factors
if factors is not None and getattr(self, 'show_legend', False):
new_style['legend'] = key
cmapper = self._get_colormapper(v, element, ranges,
dict(style), name=k+'_color_mapper',
group=group, **kwargs)
if isinstance(cmapper, CategoricalColorMapper) and val.dtype.kind in 'ifMu':
categorical = isinstance(cmapper, CategoricalColorMapper)
if categorical and val.dtype.kind in 'ifMu':
if v.dimension in element:
formatter = element.get_dimension(v.dimension).pprint_value
else:
Expand All @@ -1044,6 +1043,8 @@ def _apply_transforms(self, element, data, ranges, style, group=None):
data[k+'_str__'] = [formatter(d) for d in val]
else:
field = k
if categorical and getattr(self, 'show_legend', False):
new_style['legend'] = field
key = {'field': field, 'transform': cmapper}
new_style[k] = key

Expand Down
4 changes: 2 additions & 2 deletions holoviews/plotting/bokeh/path.py
Expand Up @@ -15,7 +15,7 @@
from .util import bokeh_version, multi_polygons_data


class PathPlot(ColorbarPlot):
class PathPlot(LegendPlot, ColorbarPlot):

show_legend = param.Boolean(default=False, doc="""
Whether to show legend for the plot.""")
Expand Down Expand Up @@ -143,7 +143,7 @@ def get_batched_data(self, element, ranges=None):
return data, elmapping, style


class ContourPlot(LegendPlot, PathPlot):
class ContourPlot(PathPlot):

show_legend = param.Boolean(default=False, doc="""
Whether to show legend for the plot.""")
Expand Down

0 comments on commit 2d802e1

Please sign in to comment.