Skip to content

Commit

Permalink
Fixed Labels bokeh plot
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr committed Mar 1, 2018
1 parent 2b3a004 commit 54e6fe4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 14 deletions.
1 change: 1 addition & 0 deletions holoviews/plotting/bokeh/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ def colormap_generator(palette):
options.HLine = Options('style', color=Cycle(), line_width=3, alpha=1)
options.VLine = Options('style', color=Cycle(), line_width=3, alpha=1)
options.Arrow = Options('style', arrow_size=10)
options.Labels = Options('style', text_align='center', text_baseline='middle')

# Graphs
options.Graph = Options('style', node_size=15, node_fill_color=Cycle(),
Expand Down
21 changes: 7 additions & 14 deletions holoviews/plotting/bokeh/annotation.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
'-': None}

from ...element import HLine
from ...core.util import datetime_types
from ...core.util import datetime_types, dimension_sanitizer
from .element import (ElementPlot, CompositeElementPlot,
text_properties, line_properties)
from .util import date_to_integer
Expand Down Expand Up @@ -65,22 +65,15 @@ class LabelsPlot(ElementPlot):
_plot_methods = dict(single='text', batched='text')
_batched_style_opts = text_properties

def get_data(self, element, ranges=None, empty=False):
def get_data(self, element, ranges, style):
style = self.style[self.cyclic_index]
dims = element.dimensions(label=True)

xidx, yidx = (1, 0) if self.invert_axes else (0, 1)
mapping = dict(x=dims[xidx], y=dims[yidx])
data = {}

xdim, ydim = dims[xidx], dims[yidx]
data[xdim] = element.dimension_values(xidx)
data[ydim] = element.dimension_values(yidx)
coords = (1, 0) if self.invert_axes else (0, 1)
xdim, ydim, tdim = (dimension_sanitizer(dims[i]) for i in coords+(2,))
mapping = dict(x=xdim, y=ydim, text=tdim)
data = {d: element.dimension_values(d) for d in (xdim, ydim, tdim)}
self._categorize_data(data, (xdim, ydim), element.dimensions())

text_dim = dims[2]
data[text_dim] = element.dimension_values(text_dim)
return data, mapping
return data, mapping, style



Expand Down

0 comments on commit 54e6fe4

Please sign in to comment.