当前位置: 首页>>代码示例>>Python>>正文


Python Store.options方法代码示例

本文整理汇总了Python中holoviews.Store.options方法的典型用法代码示例。如果您正苦于以下问题:Python Store.options方法的具体用法?Python Store.options怎么用?Python Store.options使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在holoviews.Store的用法示例。


在下文中一共展示了Store.options方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_builder_cross_backend_validation

# 需要导入模块: from holoviews import Store [as 别名]
# 或者: from holoviews.Store import options [as 别名]
    def test_builder_cross_backend_validation(self):
        Store.options(val=self.store_mpl, backend='matplotlib')
        Store.options(val=self.store_bokeh, backend='bokeh')
        Store.set_current_backend('bokeh')
        opts.Curve(line_dash='dotted') # Bokeh keyword
        opts.Curve(linewidth=10)       # MPL keyword
        err = ("In opts.Curve\(...\),  keywords supplied are mixed across backends. "
               "Keyword\(s\) 'linewidth' are invalid for bokeh, "
               "'line_dash' are invalid for matplotlib")
        with self.assertRaisesRegexp(ValueError, err):
            opts.Curve(linewidth=10, line_dash='dotted') # Bokeh and MPL

        # Non-existent keyword across backends (bokeh active)
        err = ("In opts.Curve\(...\), unexpected option 'foobar' for Curve type "
               "across all extensions. Similar options for current "
               "extension \('bokeh'\) are: \['toolbar'\].")
        with self.assertRaisesRegexp(ValueError, err):
            opts.Curve(foobar=3)

        # Non-existent keyword across backends (matplotlib active)
        Store.set_current_backend('matplotlib')

        err = ("In opts.Curve\(...\), unexpected option 'foobar' for Curve "
               "type across all extensions. No similar options found.")
        with self.assertRaisesRegexp(ValueError, err):
            opts.Curve(foobar=3)
开发者ID:basnijholt,项目名称:holoviews,代码行数:28,代码来源:testoptions.py

示例2: clear_options

# 需要导入模块: from holoviews import Store [as 别名]
# 或者: from holoviews.Store import options [as 别名]
 def clear_options(self):
     # Clear global options..
     Store.options(val=OptionTree(groups=['plot', 'style']), backend='matplotlib')
     Store.options(val=OptionTree(groups=['plot', 'style']), backend='bokeh')
     # ... and custom options
     Store.custom_options({}, backend='matplotlib')
     Store.custom_options({}, backend='bokeh')
开发者ID:mforbes,项目名称:holoviews,代码行数:9,代码来源:testoptions.py

示例3: tearDown

# 需要导入模块: from holoviews import Store [as 别名]
# 或者: from holoviews.Store import options [as 别名]
    def tearDown(self):
        Store.options(val=self.store_mpl, backend='matplotlib')
        Store.options(val=self.store_bokeh, backend='bokeh')
        Store.current_backend = 'matplotlib'
        Store._custom_options = {k:{} for k in Store._custom_options.keys()}

        if self.plotly_options is not None:
            Store._options['plotly'] = self.plotly_options

        super(TestCrossBackendOptionSpecification, self).tearDown()
开发者ID:basnijholt,项目名称:holoviews,代码行数:12,代码来源:testoptions.py

示例4: setUp

# 需要导入模块: from holoviews import Store [as 别名]
# 或者: from holoviews.Store import options [as 别名]
    def setUp(self):

        if 'bokeh' not in Store.renderers:
            raise SkipTest("Cross background tests assumes bokeh is available.")
        self.store_mpl = OptionTree(sorted(Store.options(backend='matplotlib').items()),
                                    groups=['style', 'plot', 'norm'])
        self.store_bokeh = OptionTree(sorted(Store.options(backend='bokeh').items()),
                                    groups=['style', 'plot', 'norm'])
        self.clear_options()
        super(TestCrossBackendOptions, self).setUp()
开发者ID:mforbes,项目名称:holoviews,代码行数:12,代码来源:testoptions.py

示例5: setUp

# 需要导入模块: from holoviews import Store [as 别名]
# 或者: from holoviews.Store import options [as 别名]
    def setUp(self):
        if 'matplotlib' not in Store.renderers:
            raise SkipTest("Cross background tests assumes matplotlib is available")
        if 'bokeh' not in Store.renderers:
            raise SkipTest("Cross background tests assumes bokeh is available.")

        # Some tests require that plotly isn't loaded
        self.plotly_options = Store._options.pop('plotly', None)
        self.store_mpl = OptionTree(sorted(Store.options(backend='matplotlib').items()),
                                    groups=Options._option_groups)
        self.store_bokeh = OptionTree(sorted(Store.options(backend='bokeh').items()),
                                    groups=Options._option_groups)
        super(TestCrossBackendOptionSpecification, self).setUp()
开发者ID:basnijholt,项目名称:holoviews,代码行数:15,代码来源:testoptions.py

示例6: test_builder_backend_switch

# 需要导入模块: from holoviews import Store [as 别名]
# 或者: from holoviews.Store import options [as 别名]
 def test_builder_backend_switch(self):
     Store.options(val=self.store_mpl, backend='matplotlib')
     Store.options(val=self.store_bokeh, backend='bokeh')
     Store.set_current_backend('bokeh')
     self.assertEqual(opts.Curve.__doc__.startswith('Curve('), True)
     docline = opts.Curve.__doc__.splitlines()[0]
     dockeys = eval(docline.replace('Curve', 'dict'))
     self.assertEqual('color' in dockeys, True)
     self.assertEqual('line_width' in dockeys, True)
     Store.set_current_backend('matplotlib')
     self.assertEqual(opts.Curve.__doc__.startswith('Curve('), True)
     docline = opts.Curve.__doc__.splitlines()[0]
     dockeys = eval(docline.replace('Curve', 'dict'))
     self.assertEqual('color' in dockeys, True)
     self.assertEqual('linewidth' in dockeys, True)
开发者ID:basnijholt,项目名称:holoviews,代码行数:17,代码来源:testoptions.py

示例7: init_notebook

# 需要导入模块: from holoviews import Store [as 别名]
# 或者: from holoviews.Store import options [as 别名]
def init_notebook(mpl=True):
    # Enable inline plotting in the notebook
    if mpl:
        try:
            get_ipython().enable_matplotlib(gui='inline')
        except NameError:
            pass

    print('Populated the namespace with:\n' +
        ', '.join(init_mooc_nb) +
        '\nfrom code/edx_components:\n' +
        ', '.join(edx_components.__all__) +
        '\nfrom code/functions:\n' +
        ', '.join(functions.__all__))

    holoviews.notebook_extension('matplotlib')

    Store.renderers['matplotlib'].fig = 'svg'

    holoviews.plotting.mpl.MPLPlot.fig_rcparams['text.usetex'] = True
    
    latex_packs = [r'\usepackage{amsmath}',
                   r'\usepackage{amssymb}'
                   r'\usepackage{bm}']

    holoviews.plotting.mpl.MPLPlot.fig_rcparams['text.latex.preamble'] = latex_packs

    # Set plot style.
    options = Store.options(backend='matplotlib')
    options.Contours = Options('style', linewidth=2, color='k')
    options.Contours = Options('plot', aspect='square')
    options.HLine = Options('style', linestyle='--', color='b', linewidth=2)
    options.VLine = Options('style', linestyle='--', color='r', linewidth=2)
    options.Image = Options('style', cmap='RdBu_r')
    options.Image = Options('plot', title_format='{label}')
    options.Path = Options('style', linewidth=1.2, color='k')
    options.Path = Options('plot', aspect='square', title_format='{label}')
    options.Curve = Options('style', linewidth=2, color='k')
    options.Curve = Options('plot', aspect='square', title_format='{label}')
    options.Overlay = Options('plot', show_legend=False, title_format='{label}')
    options.Layout = Options('plot', title_format='{label}')
    options.Surface = Options('style', cmap='RdBu_r', rstride=1, cstride=1, lw=0.2)
    options.Surface = Options('plot', azimuth=20, elevation=8)

    # Turn off a bogus holoviews warning.
    # Temporary solution to ignore the warnings
    warnings.filterwarnings('ignore', r'All-NaN (slice|axis) encountered')

    module_dir = os.path.dirname(__file__)
    matplotlib.rc_file(os.path.join(module_dir, "matplotlibrc"))

    np.set_printoptions(precision=2, suppress=True,
                        formatter={'complexfloat': pretty_fmt_complex})

    # Patch a bug in holoviews
    if holoviews.__version__.release <= (1, 4, 3):
        from patch_holoviews import patch_all
        patch_all()
开发者ID:LionSR,项目名称:topocm_content,代码行数:60,代码来源:init_mooc_nb.py

示例8: init_notebook

# 需要导入模块: from holoviews import Store [as 别名]
# 或者: from holoviews.Store import options [as 别名]
def init_notebook():
    # Enable inline plotting in the notebook
    try:
        get_ipython().enable_matplotlib(gui='inline')
    except NameError:
        pass

    print('Populated the namespace with:\n' + ', '.join(__all__))
    holoviews.notebook_extension('matplotlib')
    holoviews.plotting.mpl.MPLPlot.fig_rcparams['text.usetex'] = True

    # Set plot style.
    options = Store.options(backend='matplotlib')
    options.Contours = Options('style', linewidth=2, color='k')
    options.Contours = Options('plot', aspect='square')
    options.HLine = Options('style', linestyle='--', color='b', linewidth=2)
    options.VLine = Options('style', linestyle='--', color='r', linewidth=2)
    options.Image = Options('style', cmap='RdBu_r')
    options.Image = Options('plot', title_format='{label}')
    options.Path = Options('style', linewidth=1.2, color='k')
    options.Path = Options('plot', aspect='square', title_format='{label}')
    options.Curve = Options('style', linewidth=2, color='k')
    options.Curve = Options('plot', aspect='square', title_format='{label}')
    options.Overlay = Options('plot', show_legend=False, title_format='{label}')
    options.Layout = Options('plot', title_format='{label}')
    options.Surface = Options('style', cmap='RdBu_r', rstride=1, cstride=1, lw=0.2)
    options.Surface = Options('plot', azimuth=20, elevation=8)

    # Turn off a bogus holoviews warning.
    # Temporary solution to ignore the warnings
    warnings.filterwarnings('ignore', r'All-NaN (slice|axis) encountered')

    module_dir = os.path.dirname(__file__)
    matplotlib.rc_file(os.path.join(module_dir, "matplotlibrc"))

    np.set_printoptions(precision=2, suppress=True,
                        formatter={'complexfloat': pretty_fmt_complex})

    # In order to make the notebooks readable through nbviewer we want to hide
    # the code by default. However the same code is executed by the students,
    # and in that case we don't want to hide the code. So we check if the code
    # is executed by one of the mooc developers. Here we do by simply checking
    # for some files that belong to the internal mooc repository, but are not
    # published.  This is a temporary solution, and should be improved in the
    # long run.

    developer = os.path.exists(os.path.join(module_dir, os.path.pardir,
                                            'scripts'))

    display_html(display.HTML(nb_html_header +
                              (hide_outside_ipython if developer else '')))

    # Patch a bug in holoviews
    from patch_holoviews import patch_all
    patch_all()
开发者ID:Strange-G,项目名称:topocm_content,代码行数:57,代码来源:init_mooc_nb.py

示例9: init_notebook

# 需要导入模块: from holoviews import Store [as 别名]
# 或者: from holoviews.Store import options [as 别名]
def init_notebook():
    print_information()
    check_versions()

    code_dir = os.path.dirname(os.path.realpath(__file__))
    hv_css = os.path.join(code_dir, 'hv_widgets_settings.css')
    holoviews.plotting.widgets.SelectionWidget.css = hv_css

    holoviews.notebook_extension('matplotlib')

    # Enable inline plotting in the notebook
    get_ipython().enable_matplotlib(gui='inline')

    Store.renderers['matplotlib'].fig = 'svg'
    Store.renderers['matplotlib'].dpi = 100

    holoviews.plotting.mpl.MPLPlot.fig_rcparams['text.usetex'] = True

    latex_packs = [r'\usepackage{amsmath}',
                   r'\usepackage{amssymb}'
                   r'\usepackage{bm}']

    holoviews.plotting.mpl.MPLPlot.fig_rcparams['text.latex.preamble'] = \
        latex_packs

    # Set plot style.
    options = Store.options(backend='matplotlib')
    options.Contours = Options('style', linewidth=2, color='k')
    options.Contours = Options('plot', aspect='square')
    options.HLine = Options('style', linestyle='--', color='b', linewidth=2)
    options.VLine = Options('style', linestyle='--', color='r', linewidth=2)
    options.Image = Options('style', cmap='RdBu_r')
    options.Image = Options('plot', title_format='{label}')
    options.Path = Options('style', linewidth=1.2, color='k')
    options.Path = Options('plot', aspect='square', title_format='{label}')
    options.Curve = Options('style', linewidth=2, color='k')
    options.Curve = Options('plot', aspect='square', title_format='{label}')
    options.Overlay = Options('plot', show_legend=False, title_format='{label}')
    options.Layout = Options('plot', title_format='{label}')
    options.Surface = Options('style', cmap='RdBu_r', rstride=2, cstride=2,
                              lw=0.2, edgecolors='k')
    options.Surface = Options('plot', azimuth=20, elevation=8)

    # Set slider label formatting
    for dimension_type in [float, np.float64, np.float32]:
        holoviews.Dimension.type_formatters[dimension_type] = pretty_fmt_complex

    matplotlib.rc_file(os.path.join(code_dir, "matplotlibrc"))

    np.set_printoptions(precision=2, suppress=True,
                        formatter={'complexfloat': pretty_fmt_complex})
开发者ID:Huaguiyuan,项目名称:phys_codes,代码行数:53,代码来源:init_mooc_nb.py

示例10: circular_dist

# 需要导入模块: from holoviews import Store [as 别名]
# 或者: from holoviews.Store import options [as 别名]
                    feature_delta = circular_dist(preferred, feature_slice, feature.range[1])
                else:
                    feature_delta = np.abs(feature_slice - preferred)
                deltas.append(feature_delta)
                weights.append(weight_slice)
            deltas = np.concatenate(deltas)
            weights = np.concatenate(weights)
            bin_range = (0, feature.range[1] / 2.0) if feature.cyclic else None
            bins, edges = np.histogram(
                deltas, range=bin_range, bins=self.p.num_bins, weights=weights, normed=self.p.normalized
            )
            # Construct Elements
            label = " ".join([s, p])
            group = "%s Weight Distribution" % self.p.feature
            histogram = Histogram(
                bins,
                edges,
                group=group,
                label=label,
                kdims=[" ".join([self.p.feature, "Difference"])],
                vdims=["Weight"],
            )

            layout.WeightDistribution["_".join([s, p])] = histogram

        return layout


options = Store.options(backend="matplotlib")
options.Histogram.Weight_Isotropy = Options("plot", projection="polar", show_grid=True)
开发者ID:zdx3578,项目名称:topographica,代码行数:32,代码来源:weights.py

示例11: setUp

# 需要导入模块: from holoviews import Store [as 别名]
# 或者: from holoviews.Store import options [as 别名]
    def setUp(self):
        self.store_copy = OptionTree(sorted(Store.options().items()),
                                     groups=['style', 'plot', 'norm'])
        self.backend = 'matplotlib'

        super(TestOptsUtil, self).setUp()
开发者ID:mforbes,项目名称:holoviews,代码行数:8,代码来源:testutils.py

示例12: tearDown

# 需要导入模块: from holoviews import Store [as 别名]
# 或者: from holoviews.Store import options [as 别名]
 def tearDown(self):
     Store.options(val=self.original_options)
     Store._custom_options = {k:{} for k in Store._custom_options.keys()}
开发者ID:mforbes,项目名称:holoviews,代码行数:5,代码来源:testoptions.py

示例13: tearDown

# 需要导入模块: from holoviews import Store [as 别名]
# 或者: from holoviews.Store import options [as 别名]
 def tearDown(self):
     Store.options(val=self.store_copy)
     Store._custom_options = {k:{} for k in Store._custom_options.keys()}
     super(TestOptsUtil, self).tearDown()
开发者ID:mforbes,项目名称:holoviews,代码行数:6,代码来源:testutils.py

示例14: initialize_option_tree

# 需要导入模块: from holoviews import Store [as 别名]
# 或者: from holoviews.Store import options [as 别名]
 def initialize_option_tree(self):
     Store.options(val=OptionTree(groups=['plot', 'style']))
     options = Store.options()
     options.Image = Options('style', cmap='hot', interpolation='nearest')
     return options
开发者ID:mforbes,项目名称:holoviews,代码行数:7,代码来源:testoptions.py

示例15: tearDown

# 需要导入模块: from holoviews import Store [as 别名]
# 或者: from holoviews.Store import options [as 别名]
 def tearDown(self):
     Store.options(val=self.store_mpl, backend='matplotlib')
     Store.options(val=self.store_bokeh, backend='bokeh')
     Store.current_backend = 'matplotlib'
     super(TestCrossBackendOptions, self).tearDown()
开发者ID:ceball,项目名称:holoviews,代码行数:7,代码来源:testoptions.py


注:本文中的holoviews.Store.options方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。