Skip to content

Commit

Permalink
Define frequency_label for histogram operation
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr committed Oct 1, 2017
1 parent 26ac99d commit ea21bb5
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion holoviews/operation/element.py
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,9 @@ class histogram(Operation):
dimension = param.String(default=None, doc="""
Along which dimension of the Element to compute the histogram.""")

frequency_label = param.String(default='{dim} Frequency', doc="""
Format string defining the label of the frequency dimension of the Histogram.""")

groupby = param.ClassSelector(default=None, class_=(basestring, Dimension), doc="""
Defines a dimension to group the Histogram returning an NdOverlay of Histograms.""")

Expand Down Expand Up @@ -565,8 +568,9 @@ def _process(self, view, key=None):
if self.p.weight_dimension:
params['vdims'] = [view.get_dimension(self.p.weight_dimension)]
else:
label = self.p.frequency_label.format(dim=selected_dim)
params['vdims'] = [Dimension('{}_frequency'.format(selected_dim),
label='{} Frequency'.format(selected_dim))]
label=label)]

if view.group != view.__class__.__name__:
params['group'] = view.group
Expand Down

0 comments on commit ea21bb5

Please sign in to comment.