Permalink
Browse files

Added jitter plot option for bokeh ScatterPlot

  • Loading branch information...
philippjfr committed Dec 3, 2017
1 parent b7ec70f commit e56208e1eb6e1e4af67b6a3ffbb5a925bfc37e14
Showing with 9 additions and 0 deletions.
  1. +9 −0 holoviews/plotting/bokeh/chart.py
@@ -5,6 +5,7 @@
from bokeh.models import (CategoricalColorMapper, CustomJS, HoverTool,
FactorRange, Whisker, Band, Range1d)
from bokeh.models.tools import BoxSelectTool
from bokeh.transform import jitter
from ...core import Dataset, OrderedDict
from ...core.dimension import Dimension
@@ -34,6 +35,9 @@ class PointPlot(LegendPlot, ColorbarPlot):
Determines whether the `scaling_factor` should be applied to
the width or area of each point (default: "area").""")
jitter = param.Number(default=None, bounds=(0, None), doc="""
The amount of jitter to apply to offset the points along the x-axis.""")
scaling_factor = param.Number(default=1, bounds=(0, None), doc="""
Scaling factor which is applied to either the width or area
of each point, depending on the value of `scaling_method`.""")
@@ -91,6 +95,11 @@ def get_data(self, element, ranges, style):
data.update(sdata)
mapping.update(smapping)
if self.jitter:
axrange = 'y_range' if self.invert_axes else 'x_range'
mapping['x'] = jitter(dims[xidx], self.jitter,
range=self.handles[axrange])
self._get_hover_data(data, element)
return data, mapping, style

0 comments on commit e56208e

Please sign in to comment.