Skip to content

Commit

Permalink
Added span parameter for datashade operation (#1508)
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr authored and jlstevens committed Jun 4, 2017
1 parent 91a0917 commit 1e06adb
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion holoviews/operation/datashader.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from __future__ import absolute_import

from collections import Callable, Iterable
from distutils.version import LooseVersion
import warnings

import param
Expand Down Expand Up @@ -337,6 +338,11 @@ class shade(Operation):
and any valid transfer function that accepts data, mask, nbins
arguments.""")

clims = 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 +389,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 +417,11 @@ def _process(self, element, key=None):
else:
shade_opts['cmap'] = self.p.cmap

if self.p.clims:
shade_opts['span'] = self.p.clims
elif LooseVersion(ds.__version__) > '0.5.0' and self.p.normalization != 'eq_hist':
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 1e06adb

Please sign in to comment.