當前位置: 首頁>>代碼示例>>Python>>正文


Python Store.lookup_options方法代碼示例

本文整理匯總了Python中holoviews.core.options.Store.lookup_options方法的典型用法代碼示例。如果您正苦於以下問題:Python Store.lookup_options方法的具體用法?Python Store.lookup_options怎麽用?Python Store.lookup_options使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在holoviews.core.options.Store的用法示例。


在下文中一共展示了Store.lookup_options方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_apply_options_when_backend_switched

# 需要導入模塊: from holoviews.core.options import Store [as 別名]
# 或者: from holoviews.core.options.Store import lookup_options [as 別名]
 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,代碼行數:12,代碼來源:testdimensioned.py

示例2: test_overlay_options_complete

# 需要導入模塊: from holoviews.core.options import Store [as 別名]
# 或者: from holoviews.core.options.Store import lookup_options [as 別名]
    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,代碼行數:13,代碼來源:teststoreoptions.py

示例3: test_apply_options_explicit_backend_persists_other_backend_inverted

# 需要導入模塊: from holoviews.core.options import Store [as 別名]
# 或者: from holoviews.core.options.Store import lookup_options [as 別名]
 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,代碼行數:14,代碼來源:testdimensioned.py

示例4: test_overlay_options_partitioned

# 需要導入模塊: from holoviews.core.options import Store [as 別名]
# 或者: from holoviews.core.options.Store import lookup_options [as 別名]
    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,代碼行數:15,代碼來源:teststoreoptions.py

示例5: test_dynamic_opts_link_inputs

# 需要導入模塊: from holoviews.core.options import Store [as 別名]
# 或者: from holoviews.core.options.Store import lookup_options [as 別名]
 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,代碼行數:17,代碼來源:testdynamic.py

示例6: test_layout_options_long_style

# 需要導入模塊: from holoviews.core.options import Store [as 別名]
# 或者: from holoviews.core.options.Store import lookup_options [as 別名]
 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,代碼行數:9,代碼來源:teststoreoptions.py

示例7: test_layout_options_short_style

# 需要導入模塊: from holoviews.core.options import Store [as 別名]
# 或者: from holoviews.core.options.Store import lookup_options [as 別名]
 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,代碼行數:9,代碼來源:teststoreoptions.py

示例8: test_overlay_options_partitioned

# 需要導入模塊: from holoviews.core.options import Store [as 別名]
# 或者: from holoviews.core.options.Store import lookup_options [as 別名]
    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(
            o.Curve.I, 'plot').kwargs['show_grid'], False)
        self.assertEqual(Store.lookup_options(
            o.Curve.II, 'plot').kwargs['show_grid'], False)
        self.assertEqual(Store.lookup_options(
            o.Curve.I, 'style').kwargs['color'], 'k')
        self.assertEqual(Store.lookup_options(
            o.Curve.II, 'style').kwargs['color'], 'k')
開發者ID:cmiller8,項目名稱:holoviews,代碼行數:19,代碼來源:teststoreoptions.py

示例9: test_layout_options_short_style

# 需要導入模塊: from holoviews.core.options import Store [as 別名]
# 或者: from holoviews.core.options.Store import lookup_options [as 別名]
 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(
         layout, 'plot').kwargs['hspace'], 5)
開發者ID:cmiller8,項目名稱:holoviews,代碼行數:10,代碼來源:teststoreoptions.py

示例10: test_layout_options_long_style

# 需要導入模塊: from holoviews.core.options import Store [as 別名]
# 或者: from holoviews.core.options.Store import lookup_options [as 別名]
 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(
         layout, 'plot').kwargs['hspace'], 10)
開發者ID:cmiller8,項目名稱:holoviews,代碼行數:10,代碼來源:teststoreoptions.py

示例11: test_overlay_options_complete

# 需要導入模塊: from holoviews.core.options import Store [as 別名]
# 或者: from holoviews.core.options.Store import lookup_options [as 別名]
    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(
            o.Curve.I, 'plot').kwargs['show_grid'], True)
        self.assertEqual(Store.lookup_options(
            o.Curve.II, 'plot').kwargs['show_grid'], True)
        self.assertEqual(Store.lookup_options(
            o.Curve.I, 'style').kwargs['color'], 'b')
        self.assertEqual(Store.lookup_options(
            o.Curve.II, 'style').kwargs['color'], 'b')
開發者ID:cmiller8,項目名稱:holoviews,代碼行數:19,代碼來源:teststoreoptions.py

示例12: test_cell_opts_norm

# 需要導入模塊: from holoviews.core.options import Store [as 別名]
# 或者: from holoviews.core.options.Store import lookup_options [as 別名]
    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(self.get_object('mat1'), 'norm').options.get('axiswise',True), True)
開發者ID:aashish24,項目名稱:holoviews,代碼行數:13,代碼來源:testmagics.py

示例13: test_cell_opts_style

# 需要導入模塊: from holoviews.core.options import Store [as 別名]
# 或者: from holoviews.core.options.Store import lookup_options [as 別名]
    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(self.get_object('mat1'), 'style').options.get('cmap',None),'hot')
開發者ID:aashish24,項目名稱:holoviews,代碼行數:13,代碼來源:testmagics.py

示例14: test_cell_opts_plot

# 需要導入模塊: from holoviews.core.options import Store [as 別名]
# 或者: from holoviews.core.options.Store import lookup_options [as 別名]
    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(self.get_object('mat1'), 'plot').options.get('show_title',True),False)
開發者ID:aashish24,項目名稱:holoviews,代碼行數:13,代碼來源:testmagics.py

示例15: test_cell_opts_plot_float_division

# 需要導入模塊: from holoviews.core.options import Store [as 別名]
# 或者: from holoviews.core.options.Store import lookup_options [as 別名]
    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,代碼行數:14,代碼來源:testmagics.py


注:本文中的holoviews.core.options.Store.lookup_options方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。