How to use the holoviews.util.transform.dim function in holoviews

To help you get started, we’ve selected a few holoviews examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github holoviz / holoviews / holoviews / util / transform.py View on Github external
    def __lshift__(self, other):    return dim(self, operator.lshift, other)
    def __mod__(self, other):       return dim(self, operator.mod, other)
github holoviz / holoviews / holoviews / plotting / plotly / element.py View on Github external
def _apply_transforms(self, element, ranges, style):
        new_style = dict(style)
        for k, v in dict(style).items():
            if isinstance(v, util.basestring):
                if k == 'marker' and v in 'xsdo':
                    continue
                elif v in element:
                    v = dim(v)
                elif any(d==v for d in self.overlay_dims):
                    v = dim([d for d in self.overlay_dims if d==v][0])

            if not isinstance(v, dim):
                continue
            elif (not v.applies(element) and v.dimension not in self.overlay_dims):
                new_style.pop(k)
                self.warning('Specified %s dim transform %r could not be applied, as not all '
                             'dimensions could be resolved.' % (k, v))
                continue

            if len(v.ops) == 0 and v.dimension in self.overlay_dims:
                val = self.overlay_dims[v.dimension]
            else:
                val = v.apply(element, ranges=ranges, flat=True)
github holoviz / holoviews / holoviews / util / transform.py View on Github external
    def cumprod(self, *args, **kwargs):  return dim(self, np.cumprod,  *args, **kwargs)
    def cumsum(self, *args, **kwargs):   return dim(self, np.cumsum,  *args, **kwargs)
github holoviz / holoviews / holoviews / util / transform.py View on Github external
    def log(self, *args, **kwargs):      return dim(self, np.log, *args, **kwargs)
    def log10(self, *args, **kwargs):    return dim(self, np.log10, *args, **kwargs)
github holoviz / holoviews / holoviews / util / transform.py View on Github external
    def digitize(self, *args, **kwargs): return dim(self, digitize,  *args, **kwargs)
    def isin(self, *args, **kwargs):     return dim(self, isin,  *args, **kwargs)
github holoviz / holoviews / holoviews / util / transform.py View on Github external
    def __rtruediv__(self, other):  return dim(self, operator.truediv, other, reverse=True)
github holoviz / holoviews / holoviews / util / transform.py View on Github external
    def __rpow__(self, other):      return dim(self, operator.pow, other, reverse=True)
    def __rrshift__(self, other):   return dim(self, operator.rrshift, other)
github holoviz / holoviews / holoviews / plotting / bokeh / element.py View on Github external
def _apply_transforms(self, element, data, ranges, style, group=None):
        new_style = dict(style)
        prefix = group+'_' if group else ''
        for k, v in dict(style).items():
            if isinstance(v, util.basestring):
                if validate(k, v) == True:
                    continue
                elif v in element or (isinstance(element, Graph) and v in element.nodes):
                    v = dim(v)
                elif any(d==v for d in self.overlay_dims):
                    v = dim([d for d in self.overlay_dims if d==v][0])

            if (not isinstance(v, dim) or (group is not None and not k.startswith(group))):
                continue
            elif (not v.applies(element) and v.dimension not in self.overlay_dims):
                new_style.pop(k)
                self.param.warning(
                    'Specified %s dim transform %r could not be applied, '
                    'as not all dimensions could be resolved.' % (k, v))
                continue

            if v.dimension in self.overlay_dims:
                ds = Dataset({d.name: v for d, v in self.overlay_dims.items()},
                             list(self.overlay_dims))
                val = v.apply(ds, ranges=ranges, flat=True)[0]
            elif isinstance(element, Path) and not isinstance(element, Contours):
                val = np.concatenate([v.apply(el, ranges=ranges, flat=True)[:-1]
github holoviz / holoviews / holoviews / util / transform.py View on Github external
    def __radd__(self, other):      return dim(self, operator.add, other, reverse=True)
    def __rand__(self, other):      return dim(self, operator.and_, other)