Skip to content

Commit

Permalink
Merge pull request #900 from ioam/legend_fix_bokeh
Browse files Browse the repository at this point in the history
Fixed legends for bokeh >=0.12.3
  • Loading branch information
jlstevens authored Oct 5, 2016
2 parents 1ae66c0 + decf72f commit e4ffb41
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions holoviews/plotting/bokeh/element.py
Original file line number Diff line number Diff line change
Expand Up @@ -964,14 +964,23 @@ def _process_legend(self):
if self.legend_position not in self.legend_specs:
plot.legend.location = self.legend_position
plot.legend.orientation = 'horizontal' if self.legend_cols else 'vertical'
legends = plot.legend[0].legends
new_legends = []
for label, l in legends:
if label in legend_labels:
continue
legend_labels.append(label)
new_legends.append((label, l))
plot.legend[0].legends[:] = new_legends
if bokeh_version > '0.12.2':
legends = plot.legend[0].items
for item in legends:
if item.label in legend_labels:
continue
legend_labels.append(item.label)
new_legends.append(item)
plot.legend[0].items[:] = new_legends
else:
legends = plot.legend[0].legends
for label, l in legends:
if label in legend_labels:
continue
legend_labels.append(label)
new_legends.append((label, l))
plot.legend[0].legends[:] = new_legends
if self.legend_position in self.legend_specs:
legend = plot.legend[0]
plot.legend[:] = []
Expand Down

0 comments on commit e4ffb41

Please sign in to comment.