Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed bug aggregating empty BoxWhisker/Violin #3397

Merged
merged 2 commits into from
Jan 15, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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