本文整理汇总了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'}
示例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")
示例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'}
示例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")
示例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])
示例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)
示例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)
示例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')
示例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)
示例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)
示例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')
示例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)
示例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')
示例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)
示例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)