Skip to content

Commit

Permalink
Fixed bug aggregating empty BoxWhisker/Violin (#3397)
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr authored Jan 15, 2019
1 parent dd812fc commit 9dc2b1c
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions holoviews/plotting/bokeh/stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

from bokeh.models import FactorRange, Circle, VBar, HBar

from ...core.dimension import Dimension
from ...core.dimension import Dimension, Dimensioned
from ...core.ndmapping import sorted_context
from ...core.util import (basestring, dimension_sanitizer, wrap_tuple,
unique_iterator, isfinite)
Expand Down Expand Up @@ -102,7 +102,11 @@ def _apply_transforms(self, element, data, ranges, style, group=None):
if element.ndims > 0:
element = element.aggregate(function=np.mean)
else:
element = element.clone([(element.aggregate(function=np.mean),)])
agg = element.aggregate(function=np.mean)
if isinstance(agg, Dimensioned):
element = agg
else:
element = element.clone([(element,)])
return super(BoxWhiskerPlot, self)._apply_transforms(element, data, ranges, style, group)

def _get_factors(self, element):
Expand Down Expand Up @@ -345,8 +349,11 @@ def _kde_data(self, el, key, **kwargs):
elif self.inner == 'quartiles':
for stat_fn in self._stat_fns:
stat = stat_fn(values)
sidx = np.argmin(np.abs(xs-stat))
sx, sy = xs[sidx], ys[sidx]
if len(xs):
sidx = np.argmin(np.abs(xs-stat))
sx, sy = xs[sidx], ys[sidx]
else:
continue
segments['x'].append(sx)
segments['y0'].append(key+(-sy[-1],))
segments['y1'].append(sy)
Expand Down

0 comments on commit 9dc2b1c

Please sign in to comment.