How to use the holoviews.core.options.Options 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 / tests / ipython / testparsers.py View on Github external
def test_norm_opts_simple_2(self):
        line = "Layout {+axiswise +framewise}"
        expected= {'Layout':
                   {'norm': Options(axiswise=True, framewise=True)}}
        self.assertEqual(OptsSpec.parse(line), expected)
github holoviz / holoviews / tests / core / testoptions.py View on Github external
def setUp(self):
        self.store_copy = OptionTree(sorted(Store.options().items()),
                                     groups=['style', 'plot', 'norm'])
        self.backend = 'matplotlib'
        Store.current_backend = self.backend
        Store.options(val=OptionTree(groups=['plot', 'style']))

        options = Store.options()

        self.default_plot = dict(plot1='plot1', plot2='plot2')
        options.Histogram = Options('plot', **self.default_plot)

        self.default_style = dict(style1='style1', style2='style2')
        options.Histogram = Options('style', **self.default_style)

        data = [np.random.normal() for i in range(10000)]
        frequencies, edges = np.histogram(data, 20)
        self.hist = Histogram(frequencies, edges)
        super(TestStoreInheritance, self).setUp()
github holoviz / holoviews / tests / core / testoptions.py View on Github external
def test_cyclic_property_false(self):
        opts = Options('test', one='one', two='two')
        self.assertEqual(opts.cyclic, False)
github holoviz / holoviews / holoviews / core / accessors.py View on Github external
Args:
            group: The options group. Flattens across groups if None.
            backend: Current backend if None otherwise chosen backend.

        Returns:
            Options object associated with the object containing the
            applied option keywords.
        """
        from .options import Store, Options
        keywords = {}
        groups = Options._option_groups if group is None else [group]
        backend = backend if backend else Store.current_backend
        for group in groups:
            optsobj = Store.lookup_options(backend, self._obj, group)
            keywords = dict(keywords, **optsobj.kwargs)
        return Options(**keywords)
github holoviz / holoviews / holoviews / plotting / bokeh / __init__.py View on Github external
options.Box = Options('style', color='black')
options.Bounds = Options('style', color='black')
options.Ellipse = Options('style', color='black')
options.Polygons = Options('style', color=Cycle(), line_color='black',
                           cmap='viridis')

# Rasters
options.Image = Options('style', cmap=dflt_cmap)
options.Raster = Options('style', cmap=dflt_cmap)
options.QuadMesh = Options('style', cmap=dflt_cmap, line_alpha=0)
options.HeatMap = Options('style', cmap='RdYlBu_r', annular_line_alpha=0,
                          xmarks_line_color="#FFFFFF", xmarks_line_width=3,
                          ymarks_line_color="#FFFFFF", ymarks_line_width=3)

# Annotations
options.HLine = Options('style', color=Cycle(), line_width=3, alpha=1)
options.VLine = Options('style', color=Cycle(), line_width=3, alpha=1)
options.Arrow = Options('style', arrow_size=10)
options.Labels = Options('style', text_align='center', text_baseline='middle')

# Graphs
options.Graph = Options(
    'style', node_size=15, node_fill_color=Cycle(),
    node_line_color='black', node_nonselection_fill_color=Cycle(),
    node_hover_line_color='black', node_hover_fill_color='limegreen',
    node_nonselection_alpha=0.2, edge_nonselection_alpha=0.2,
    node_nonselection_line_color='black', edge_line_color='black',
    edge_line_width=2, edge_nonselection_line_color='black',
    edge_hover_line_color='limegreen'
)
options.TriMesh = Options(
    'style', node_size=5, node_line_color='black',
github holoviz / holoviews / holoviews / core / options.py View on Github external
Allows creating sub OptionTree instances using attribute
        access, inheriting the group options.
        """
        try:
            return super(AttrTree, self).__getattr__(identifier)
        except AttributeError: pass

        if identifier.startswith('_'):   raise AttributeError(str(identifier))
        elif self.fixed==True:           raise AttributeError(self._fixed_error % identifier)

        valid_id = sanitize_identifier(identifier, escape=False)
        if valid_id in self.children:
            return self.__dict__[valid_id]

        # When creating a intermediate child node, leave kwargs empty
        self.__setattr__(identifier, {k:Options(k, allowed_keywords=v.allowed_keywords)
                                      for k,v in self.groups.items()})
        return self[identifier]
github holoviz / holoviews / holoviews / core / options.py View on Github external
def _merge_options(self, identifier, group_name, options):
        """
        Computes a merged Options object for the given group
        name from the existing Options on the node and the
        new Options which are passed in.
        """
        if group_name not in self.groups:
            raise KeyError("Group %s not defined on SettingTree" % group_name)

        if identifier in self.children:
            current_node = self[identifier]
            group_options = current_node.groups[group_name]
        else:
            #When creating a node (nothing to merge with) ensure it is empty
            group_options = Options(group_name,
                     allowed_keywords=self.groups[group_name].allowed_keywords)

        override_kwargs = dict(options.kwargs)
        old_allowed = group_options.allowed_keywords
        override_kwargs['allowed_keywords'] = options.allowed_keywords + old_allowed

        try:
            return (group_options(**override_kwargs)
                    if options.merge_keywords else Options(group_name, **override_kwargs))
        except OptionError as e:
            raise OptionError(e.invalid_keyword,
                              e.allowed_keywords,
                              group_name=group_name,
                              path = self.path)
github holoviz / holoviews / holoviews / plotting / mpl / __init__.py View on Github external
options.HeatMap = Options('style', cmap='RdYlBu_r', interpolation='nearest',
                          annular_edgecolors='white', annular_linewidth=0.5,
                          xmarks_edgecolor='white', xmarks_linewidth=3,
                          ymarks_edgecolor='white', ymarks_linewidth=3)
options.HeatMap = Options('plot', show_values=True)
options.RGB = Options('style', interpolation='nearest')
# Composites
options.Layout = Options('plot', sublabel_format='{Alpha}')
options.GridMatrix = Options('plot', fig_size=160, shared_xaxis=True,
                             shared_yaxis=True, xaxis=None, yaxis=None)

# Annotations
options.VLine = Options('style', color=Cycle())
options.HLine = Options('style', color=Cycle())
if config.style_17:
    options.Spline = Options('style', linewidth=2, edgecolor='r')
else:
    options.Spline = Options('style', edgecolor=Cycle())

options.Text = Options('style', fontsize=13)
options.Arrow = Options('style', color='k', linewidth=2, fontsize=13)
# Paths
options.Contours = Options('style', color=Cycle(), cmap='viridis')
options.Contours = Options('plot', show_legend=True)
options.Path = Options('style', color=Cycle(), cmap='viridis')

if config.style_17:
    options.Box = Options('style', color=Cycle())
    options.Bounds = Options('style', color=Cycle())
    options.Ellipse = Options('style', color=Cycle())
else:
    options.Box = Options('style', color='black')
github holoviz / holoviews / holoviews / plotting / bokeh / __init__.py View on Github external
options.Polygons = Options('style', color=Cycle(), line_color='black',
                           cmap='viridis')

# Rasters
options.Image = Options('style', cmap=dflt_cmap)
options.Raster = Options('style', cmap=dflt_cmap)
options.QuadMesh = Options('style', cmap=dflt_cmap, line_alpha=0)
options.HeatMap = Options('style', cmap='RdYlBu_r', annular_line_alpha=0,
                          xmarks_line_color="#FFFFFF", xmarks_line_width=3,
                          ymarks_line_color="#FFFFFF", ymarks_line_width=3)

# Annotations
options.HLine = Options('style', color=Cycle(), line_width=3, alpha=1)
options.VLine = Options('style', color=Cycle(), line_width=3, alpha=1)
options.Arrow = Options('style', arrow_size=10)
options.Labels = Options('style', text_align='center', text_baseline='middle')

# Graphs
options.Graph = Options(
    'style', node_size=15, node_fill_color=Cycle(),
    node_line_color='black', node_nonselection_fill_color=Cycle(),
    node_hover_line_color='black', node_hover_fill_color='limegreen',
    node_nonselection_alpha=0.2, edge_nonselection_alpha=0.2,
    node_nonselection_line_color='black', edge_line_color='black',
    edge_line_width=2, edge_nonselection_line_color='black',
    edge_hover_line_color='limegreen'
)
options.TriMesh = Options(
    'style', node_size=5, node_line_color='black',
    node_fill_color='white', edge_line_color='black',
    node_hover_fill_color='limegreen', edge_line_width=1,
    edge_hover_line_color='limegreen', edge_nonselection_alpha=0.2,