How to use the param.NumericTuple function in param

To help you get started, we’ve selected a few param 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 / operation / element.py View on Github external
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
         update RangeXY streams on the inputs of the shade operation.""")

    max_samples = param.Integer(default=5000, doc="""
        Maximum number of samples to display at the same time.""")

    random_seed = param.Integer(default=42, doc="""
        Seed used to initialize randomization.""")

    streams = param.List(default=[RangeXY], doc="""
        List of streams that are applied if dynamic=True, allowing
        for dynamic interaction with the plot.""")

    x_range  = param.NumericTuple(default=None, length=2, doc="""
       The x_range as a tuple of min and max x-value. Auto-ranges
       if set to None.""")

    y_range  = param.NumericTuple(default=None, length=2, doc="""
       The x_range as a tuple of min and max y-value. Auto-ranges
       if set to None.""")

    def _process_layer(self, element, key=None):
        if not isinstance(element, Dataset):
            raise ValueError("Cannot downsample non-Dataset types.")
        if element.interface not in column_interfaces:
            element = element.clone(tuple(element.columns().values()))

        xstart, xend = self.p.x_range if self.p.x_range else element.range(0)
        ystart, yend = self.p.y_range if self.p.y_range else element.range(1)
github pyviz-dev / nbsite / examples / sites / holoviews / holoviews / operation / datashader.py View on Github external
colormap.""")

    color_key = param.ClassSelector(class_=(Iterable, Callable, dict), doc="""
        Iterable or callable which returns colors as hex colors, to
        be used for the color key of categorical datashader output.
        Callable type must allow mapping colors between 0 and 1.""")

    normalization = param.ClassSelector(default='eq_hist',
                                        class_=(basestring, Callable),
                                        doc="""
        The normalization operation applied before colormapping.
        Valid options include 'linear', 'log', 'eq_hist', 'cbrt',
        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
        update RangeXY streams on the inputs of the shade operation.
        Disable when you do not want the resulting plot to be interactive,
        e.g. when trying to display an interactive plot a second time.""")

    @classmethod
    def concatenate(cls, overlay):
        """
        Concatenates an NdOverlay of Image types into a single 3D
        xarray Dataset.
github holoviz / holoviews / holoviews / plotting / mpl / plot.py View on Github external
plot object and the displayed object; other plotting handles
        can be accessed via plot.handles.""")

    finalize_hooks = param.HookList(default=[], doc="""
        Deprecated; use hooks options instead.""")

    hooks = param.HookList(default=[], doc="""
        Optional list of hooks called when finalizing a plot. The
        hook is passed the plot object and the displayed element, and
        other plotting handles can be accessed via plot.handles.""")

    sublabel_format = param.String(default=None, allow_None=True, doc="""
        Allows labeling the subaxes in each plot with various formatters
        including {Alpha}, {alpha}, {numeric} and {roman}.""")

    sublabel_position = param.NumericTuple(default=(-0.35, 0.85), doc="""
         Position relative to the plot for placing the optional subfigure label.""")

    sublabel_size = param.Number(default=18, doc="""
         Size of optional subfigure label.""")

    projection = param.Parameter(default=None, doc="""
        The projection of the plot axis, default of None is equivalent to
        2D plot, '3d' and 'polar' are also supported by matplotlib by default.
        May also supply a custom projection that is either a matplotlib
        projection type or implements the `_as_mpl_axes` method.""")

    show_frame = param.Boolean(default=False, doc="""
        Whether or not to show a complete frame around the plot.""")

    _close_figures = True
github holoviz / holoviews / holoviews / operation / datashader.py View on Github external
color_key = param.ClassSelector(class_=(Iterable, Callable, dict), doc="""
        Iterable or callable that returns colors as hex colors, to
        be used for the color key of categorical datashader output.
        Callable type must allow mapping colors for supplied values
        between 0 and 1.""")

    normalization = param.ClassSelector(default='eq_hist',
                                        class_=(basestring, Callable),
                                        doc="""
        The normalization operation applied before colormapping.
        Valid options include 'linear', 'log', 'eq_hist', 'cbrt',
        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.
        """)

    min_alpha = param.Number(default=40, bounds=(0, 255), doc="""
        The minimum alpha value to use for non-empty pixels when doing
        colormapping, in [0, 255].  Use a higher value to avoid
        undersaturation, i.e. poorly visible low-value datapoints, at
        the expense of the overall dynamic range..""")

    @classmethod
    def concatenate(cls, overlay):
        """
        Concatenates an NdOverlay of Image types into a single 3D
        xarray Dataset.
        """
github holoviz / geoviews / geoviews / operation / resample.py View on Github external
Enables dynamic processing by default.""")

    preserve_topology = param.Boolean(default=False, doc="""
        Whether to preserve topology between geometries. If disabled
        simplification can produce self-intersecting or otherwise
        invalid geometries but will be much faster.""")

    streams = param.List(default=[RangeXY], doc="""
        List of streams that are applied if dynamic=True, allowing
        for dynamic interaction with the plot.""")

    tolerance_factor = param.Number(default=0.002, doc="""
        The tolerance distance for path simplification as a fraction
        of the square root of the area of the current viewport.""")

    x_range  = param.NumericTuple(default=None, length=2, doc="""
       The x_range as a tuple of min and max x-value. Auto-ranges
       if set to None.""")

    y_range  = param.NumericTuple(default=None, length=2, doc="""
       The x_range as a tuple of min and max y-value. Auto-ranges
       if set to None.""")

    zoom_levels = param.Integer(default=20, doc="""
        The number of zoom levels to cache.""")

    @param.parameterized.bothmethod
    def instance(self_or_cls,**params):
        inst = super(resample_geometry, self_or_cls).instance(**params)
        inst._cache = {}
        return inst
github pyviz-dev / nbsite / examples / sites / holoviews / holoviews / operation / stats.py View on Github external
Method of automatically determining KDE bandwidth""")

    bandwidth = param.Number(default=None, doc="""
        Allows supplying explicit bandwidth value rather than relying
        on scott or silverman method.""")

    cut = param.Number(default=3, doc="""
        Draw the estimate to cut * bw from the extreme data points.""")

    filled = param.Boolean(default=False, doc="""
        Controls whether to return filled or unfilled contours.""")

    n_samples = param.Integer(default=100, doc="""
        Number of samples to compute the KDE over.""")

    x_range  = param.NumericTuple(default=None, length=2, doc="""
       The x_range as a tuple of min and max x-value. Auto-ranges
       if set to None.""")

    y_range  = param.NumericTuple(default=None, length=2, doc="""
       The x_range as a tuple of min and max y-value. Auto-ranges
       if set to None.""")

    def _process(self, element, key=None):
        try:
            from scipy import stats
        except ImportError:
            raise ImportError('%s operation requires SciPy to be installed.' % type(self).__name__)

        xdim, ydim = element.dimensions()[:2]
        params = {}
        if isinstance(element, Bivariate):
github holoviz / holoviews / dataviews / plots.py View on Github external
from .sheetviews import SheetView, SheetOverlay, Contours, \
                       SheetStack, Points, CoordinateGrid, DataGrid
from .views import NdMapping, Stack, GridLayout, Layout, Overlay, View,\
    Annotation, Grid


class PlotSaver(param.ParameterizedFunction):
    """
    Parameterized function for saving the plot of a View object to
    disk either as a static figure or as an animation. Keywords that
    are not parameters are passed into the anim method of the
    appropriate plot for animations and into matplotlib.figure.savefig
    for static figures.
    """

    size = param.NumericTuple(default=(5, 5), doc="""
      The matplotlib figure size in inches.""")

    filename = param.String(default=None, allow_None=True, doc="""
      This is the filename of the saved file. The output file type
      will be inferred from the file extension.""")

    anim_opts = param.Dict(
        default={'.webm':({}, ['-vcodec', 'libvpx', '-b', '1000k']),
                 '.mp4':({'codec':'libx264'}, ['-pix_fmt', 'yuv420p']),
                 '.gif':({'fps':10}, [])}, doc="""
        The arguments to matplotlib.animation.save for different
        animation formats. The key is the file extension and the tuple
        consists of the kwargs followed by a list of arguments for the
        'extra_args' keyword argument.""" )
github pyviz-dev / nbsite / examples / sites / holoviews / holoviews / plotting / bokeh / element.py View on Github external
class LegendPlot(ElementPlot):

    legend_position = param.ObjectSelector(objects=["top_right",
                                                    "top_left",
                                                    "bottom_left",
                                                    "bottom_right",
                                                    'right', 'left',
                                                    'top', 'bottom'],
                                                    default="top_right",
                                                    doc="""
        Allows selecting between a number of predefined legend position
        options. The predefined options may be customized in the
        legend_specs class attribute.""")

    legend_offset = param.NumericTuple(default=(0, 0), doc="""
        If legend is placed outside the axis, this determines the
        (width, height) offset in pixels from the original position.""")

    legend_cols = param.Integer(default=False, doc="""
       Whether to lay out the legend as columns.""")

    legend_specs = {'right': 'right', 'left': 'left', 'top': 'above',
                    'bottom': 'below'}

    def _process_legend(self, plot=None):
        plot = plot or self.handles['plot']
        if not plot.legend:
            return
        legend = plot.legend[0]
        cmapper = self.handles.get('color_mapper')
        if cmapper:
github ioam / lancet / lancet / launch.py View on Github external
A short description of the purpose of the current set of tasks.''')

    metadata = param.Dict(default={}, doc='''
       Metadata information to add to the info file.''')

    max_concurrency = param.Integer(default=2, allow_None=True, doc='''
       Concurrency limit to impose on the launch. As the current class
       uses subprocess locally, multiple processes are possible at
       once. Set to None for no limit (eg. for clusters)''')

    reduction_fn = param.Callable(default=None, doc='''
      A callable that will be invoked when the Launcher has completed
      all tasks. For example, this could inform the user of completion
      (eg. send an e-mail) among other possibilities.''')

    timestamp = param.NumericTuple(default=(0,)*9, doc='''
      Optional override of timestamp (default timestamp set on launch
      call) in Python struct_time 9-tuple format.  Useful when you
      need to have a known root_directory path (see root_directory
      documentation) before launch. For example, you should store
      state related to analysis (eg. pickles) in the same location as
      everything else.''')

    timestamp_format = param.String(default='%Y-%m-%d_%H%M', allow_None=True, doc='''
      The timestamp format for the root directories in python datetime
      format. If None, the timestamp is omitted from root directory
      name.''')


    def __init__(self, batch_name, args, command, **params):

        self._pprint_args = ([],[],None,{})
github holoviz / holoviews / holoviews / operation / element.py View on Github external
geom['holes'] = interiors
            paths.append(geom)
        contours = contour_type(paths, label=element.label, kdims=element.kdims, vdims=vdims)
        if self.p.overlaid:
            contours = element * contours
        return contours


class histogram(Operation):
    """
    Returns a Histogram of the input element data, binned into
    num_bins over the bin_range (if specified) along the specified
    dimension.
    """

    bin_range = param.NumericTuple(default=None, length=2,  doc="""
      Specifies the range within which to compute the bins.""")

    bins = param.ClassSelector(default=None, class_=(np.ndarray, list, tuple), doc="""
      An explicit set of bin edges.""")

    cumulative = param.Boolean(default=False, doc="""
      Whether to compute the cumulative histogram""")

    dimension = param.String(default=None, doc="""
      Along which dimension of the Element to compute the histogram.""")

    frequency_label = param.String(default=None, 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.""")