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


Python options.Store类代码示例

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


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

示例1: tearDown

 def tearDown(self):
     Store._weakrefs = {}
     Store._options.pop('backend_1')
     Store._options.pop('backend_2')
     Store._custom_options.pop('backend_1')
     Store._custom_options.pop('backend_2')
     Store.set_current_backend(self.current_backend)
开发者ID:basnijholt,项目名称:holoviews,代码行数:7,代码来源:testdimensioned.py

示例2: test_apply_options_when_backend_switched

 def test_apply_options_when_backend_switched(self):
     obj = TestObj([])
     Store.current_backend = 'backend_2'
     obj.opts(style_opt1='A', plot_opt1='B')
     Store.current_backend = 'backend_1'
     obj.opts(style_opt1='C', plot_opt1='D', backend='backend_2')
     plot_opts = Store.lookup_options('backend_2', obj, 'plot')
     assert plot_opts.options == {'plot_opt1': 'D'}
     style_opts = Store.lookup_options('backend_2', obj, 'style')
     assert style_opts.options == {'style_opt1': 'C'}
开发者ID:basnijholt,项目名称:holoviews,代码行数:10,代码来源:testdimensioned.py

示例3: test_overlay_options_complete

    def test_overlay_options_complete(self):
        """
        Complete specification style.
        """
        data = [zip(range(10), range(10)), zip(range(5), range(5))]
        o = Overlay([Curve(c) for c in data])({"Curve.Curve": {"plot": {"show_grid": True}, "style": {"color": "b"}}})

        self.assertEqual(Store.lookup_options("matplotlib", o.Curve.I, "plot").kwargs["show_grid"], True)
        self.assertEqual(Store.lookup_options("matplotlib", o.Curve.II, "plot").kwargs["show_grid"], True)
        self.assertEqual(Store.lookup_options("matplotlib", o.Curve.I, "style").kwargs["color"], "b")
        self.assertEqual(Store.lookup_options("matplotlib", o.Curve.II, "style").kwargs["color"], "b")
开发者ID:prabhuramachandran,项目名称:holoviews,代码行数:11,代码来源:teststoreoptions.py

示例4: test_apply_options_explicit_backend_persists_other_backend_inverted

 def test_apply_options_explicit_backend_persists_other_backend_inverted(self):
     obj = TestObj([])
     obj.opts(style_opt1='A', plot_opt1='B', backend='backend_2')
     obj.opts(style_opt1='C', plot_opt1='D', backend='backend_1')
     plot_opts = Store.lookup_options('backend_1', obj, 'plot')
     assert plot_opts.options == {'plot_opt1': 'D'}
     style_opts = Store.lookup_options('backend_1', obj, 'style')
     assert style_opts.options == {'style_opt1': 'C'}
     plot_opts = Store.lookup_options('backend_2', obj, 'plot')
     assert plot_opts.options == {'plot_opt1': 'B'}
     style_opts = Store.lookup_options('backend_2', obj, 'style')
     assert style_opts.options == {'style_opt1': 'A'}
开发者ID:basnijholt,项目名称:holoviews,代码行数:12,代码来源:testdimensioned.py

示例5: test_cell_opts_norm

    def test_cell_opts_norm(self):

        self.cell("mat1 = Image(np.random.rand(5,5), name='mat1')")

        self.assertEqual(self.get_object('mat1').id, None)
        self.cell_magic('opts', " Image {+axiswise}", 'mat1')
        self.assertEqual(self.get_object('mat1').id, 0)

        assert 0 in Store.custom_options(), "Custom OptionTree creation failed"
        self.assertEqual(
            Store.lookup_options('matplotlib',
                                 self.get_object('mat1'), 'norm').options.get('axiswise',True), True)
开发者ID:RafalSkolasinski,项目名称:holoviews,代码行数:12,代码来源:testmagics.py

示例6: test_cell_opts_plot

    def test_cell_opts_plot(self):

        self.cell("mat1 = Image(np.random.rand(5,5), name='mat1')")

        self.assertEqual(self.get_object('mat1').id, None)
        self.cell_magic('opts', " Image [show_title=False]", 'mat1')
        self.assertEqual(self.get_object('mat1').id, 0)

        assert 0 in Store.custom_options(), "Custom OptionTree creation failed"
        self.assertEqual(
            Store.lookup_options('matplotlib',
                                 self.get_object('mat1'), 'plot').options.get('show_title',True),False)
开发者ID:RafalSkolasinski,项目名称:holoviews,代码行数:12,代码来源:testmagics.py

示例7: test_cell_opts_style

    def test_cell_opts_style(self):

        self.cell("mat1 = Image(np.random.rand(5,5), name='mat1')")

        self.assertEqual(self.get_object('mat1').id, None)
        self.cell_magic('opts', " Image (cmap='hot')", 'mat1')
        self.assertEqual(self.get_object('mat1').id, 0)

        assert 0 in Store.custom_options(), "Custom OptionTree creation failed"
        self.assertEqual(
            Store.lookup_options('matplotlib',
                                 self.get_object('mat1'), 'style').options.get('cmap',None),'hot')
开发者ID:RafalSkolasinski,项目名称:holoviews,代码行数:12,代码来源:testmagics.py

示例8: test_cell_opts_plot_dynamic

    def test_cell_opts_plot_dynamic(self):

        self.cell("dmap = DynamicMap(lambda X: Image(np.random.rand(5,5), name='dmap'), kdims=['x'])"
                  ".redim.range(x=(0, 10)).opts(plot={'Image': dict(xaxis='top', xticks=3)})")

        self.assertEqual(self.get_object('dmap').id, None)
        self.cell_magic('opts', " Image [xaxis=None yaxis='right']", 'dmap')
        self.assertEqual(self.get_object('dmap').id, 0)

        assert 0 in Store.custom_options(), "Custom OptionTree creation failed"
        opts = Store.lookup_options('matplotlib', self.get_object('dmap')[0], 'plot').options
        self.assertEqual(opts, {'xticks': 3, 'xaxis': None, 'yaxis': 'right'})
开发者ID:mforbes,项目名称:holoviews,代码行数:12,代码来源:testmagics.py

示例9: test_cell_opts_plot_float_division

    def test_cell_opts_plot_float_division(self):

        self.cell("mat1 = Image(np.random.rand(5,5), name='mat1')")

        self.assertEqual(self.get_object('mat1').id, None)
        self.cell_magic('opts', " Image [aspect=3/4]", 'mat1')
        self.assertEqual(self.get_object('mat1').id, 0)

        assert 0 in Store.custom_options(), "Custom OptionTree creation failed"
        self.assertEqual(
            Store.lookup_options('matplotlib',
                                 self.get_object('mat1'), 'plot').options.get('aspect',False), 3/4.0)
开发者ID:mforbes,项目名称:holoviews,代码行数:12,代码来源:testmagics.py

示例10: test_cell_opts_style_dynamic

    def test_cell_opts_style_dynamic(self):

        self.cell("dmap = DynamicMap(lambda X: Curve(np.random.rand(5,2), name='dmap'), kdims=['x'])"
                  ".redim.range(x=(0, 10)).opts(style={'Curve': dict(linewidth=2, color='black')})")

        self.assertEqual(self.get_object('dmap').id, None)
        self.cell_magic('opts', " Curve (linewidth=3 alpha=0.5)", 'dmap')
        self.assertEqual(self.get_object('dmap').id, 0)

        assert 0 in Store.custom_options(), "Custom OptionTree creation failed"
        opts = Store.lookup_options('matplotlib', self.get_object('dmap')[0], 'style').options
        self.assertEqual(opts, {'linewidth': 3, 'alpha': 0.5, 'color': 'black'})
开发者ID:mforbes,项目名称:holoviews,代码行数:12,代码来源:testmagics.py

示例11: test_overlay_options_partitioned

    def test_overlay_options_partitioned(self):
        """
        The new style introduced in #73
        """
        data = [zip(range(10), range(10)), zip(range(5), range(5))]
        o = Overlay([Curve(c) for c in data])(
            dict(plot={"Curve.Curve": {"show_grid": False}}, style={"Curve.Curve": {"color": "k"}})
        )

        self.assertEqual(Store.lookup_options("matplotlib", o.Curve.I, "plot").kwargs["show_grid"], False)
        self.assertEqual(Store.lookup_options("matplotlib", o.Curve.II, "plot").kwargs["show_grid"], False)
        self.assertEqual(Store.lookup_options("matplotlib", o.Curve.I, "style").kwargs["color"], "k")
        self.assertEqual(Store.lookup_options("matplotlib", o.Curve.II, "style").kwargs["color"], "k")
开发者ID:prabhuramachandran,项目名称:holoviews,代码行数:13,代码来源:teststoreoptions.py

示例12: test_dynamic_opts_link_inputs

 def test_dynamic_opts_link_inputs(self):
     stream = LinkedStream()
     inputs = [DynamicMap(lambda: None, streams=[stream])]
     dmap = DynamicMap(Callable(lambda X: TestObj(None), inputs=inputs),
                       kdims=['X']).redim.range(X=(0,10))
     styled_dmap = dmap.options(plot_opt1='red', clone=False)
     opts = Store.lookup_options('backend_1', dmap[0], 'plot')
     self.assertEqual(opts.options, {'plot_opt1': 'red'})
     self.assertIs(styled_dmap, dmap)
     self.assertTrue(dmap.callback.link_inputs)
     unstyled_dmap = dmap.callback.inputs[0].callback.inputs[0]
     opts = Store.lookup_options('backend_1', unstyled_dmap[0], 'plot')
     self.assertEqual(opts.options, {})
     original_dmap = unstyled_dmap.callback.inputs[0]
     self.assertIs(stream, original_dmap.streams[0])
开发者ID:basnijholt,项目名称:holoviews,代码行数:15,代码来源:testdynamic.py

示例13: test_layout_options_long_style

 def test_layout_options_long_style(self):
     """
     The old (longer) syntax in __call__
     """
     im = Image(np.random.rand(10, 10))
     layout = (im + im)({"Layout": dict(plot={"hspace": 10})})
     self.assertEqual(Store.lookup_options("matplotlib", layout, "plot").kwargs["hspace"], 10)
开发者ID:prabhuramachandran,项目名称:holoviews,代码行数:7,代码来源:teststoreoptions.py

示例14: test_layout_options_short_style

 def test_layout_options_short_style(self):
     """
     Short __call__ syntax.
     """
     im = Image(np.random.rand(10, 10))
     layout = (im + im)({"Layout": dict(plot={"hspace": 5})})
     self.assertEqual(Store.lookup_options("matplotlib", layout, "plot").kwargs["hspace"], 5)
开发者ID:prabhuramachandran,项目名称:holoviews,代码行数:7,代码来源:teststoreoptions.py

示例15: _set_style

 def _set_style(self, feature, map_type):
     fname = feature.name.capitalize()
     style_path = ('Image', fname + map_type.capitalize())
     options = Store.options(backend='matplotlib')
     if style_path not in options.data:
         cyclic = True if feature.cyclic and not map_type == 'selectivity' else False
         options[style_path] = Options('style', **(dict(cmap='hsv') if cyclic else dict()))
开发者ID:ioam,项目名称:featuremapper,代码行数:7,代码来源:__init__.py


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