Skip to content

Commit

Permalink
Added span parameter for datashade operation
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr committed Jun 2, 2017
1 parent d697f4c commit cc32e0c
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion holoviews/operation/datashader.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,11 @@ class shade(Operation):
and any valid transfer function that accepts data, mask, nbins
arguments.""")

value_range = param.NumericTuple(default=None, length=2, doc="""
Min and max data values to use for colormap interpolation, when
wishing to override autoranging.
""")

link_inputs = param.Boolean(default=True, doc="""
By default, the link_inputs parameter is set to True so that
when applying shade, backends that support linked streams
Expand Down Expand Up @@ -383,7 +388,8 @@ def _process(self, element, key=None):
else:
bounds = element.bounds

array = element.data[element.vdims[0].name]
vdim = element.vdims[0].name
array = element.data[vdim]
kdims = element.kdims

# Compute shading options depending on whether
Expand All @@ -410,6 +416,11 @@ def _process(self, element, key=None):
else:
shade_opts['cmap'] = self.p.cmap

if self.p.value_range:
shade_opts['span'] = self.p.value_range
else:
shade_opts['span'] = element.range(vdim)

with warnings.catch_warnings():
warnings.filterwarnings('ignore', r'invalid value encountered in true_divide')
if np.isnan(array.data).all():
Expand Down

0 comments on commit cc32e0c

Please sign in to comment.