本文整理汇总了Python中holoviews.util.parser.OptsSpec.parse方法的典型用法代码示例。如果您正苦于以下问题:Python OptsSpec.parse方法的具体用法?Python OptsSpec.parse怎么用?Python OptsSpec.parse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类holoviews.util.parser.OptsSpec
的用法示例。
在下文中一共展示了OptsSpec.parse方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_style_opts_intermediate_explicit
# 需要导入模块: from holoviews.util.parser import OptsSpec [as 别名]
# 或者: from holoviews.util.parser.OptsSpec import parse [as 别名]
def test_style_opts_intermediate_explicit(self):
line = "Layout style(string='foo' test=3, b=True )"
expected= {'Layout':{
'style': Options(string='foo',
test=3,
b=True)}}
self.assertEqual(OptsSpec.parse(line), expected)
示例2: test_plot_opts_with_space
# 需要导入模块: from holoviews.util.parser import OptsSpec [as 别名]
# 或者: from holoviews.util.parser.OptsSpec import parse [as 别名]
def test_plot_opts_with_space(self):
"Space in the tuple, see issue #77"
line = "Layout [fig_inches=(3, 3) title_format='foo bar']"
expected= {'Layout':
{'plot':
Options(title_format='foo bar', fig_inches=(3, 3))}}
self.assertEqual(OptsSpec.parse(line), expected)
示例3: test_combined_1
# 需要导入模块: from holoviews.util.parser import OptsSpec [as 别名]
# 或者: from holoviews.util.parser.OptsSpec import parse [as 别名]
def test_combined_1(self):
line = "Layout plot[fig_inches=(3,3) foo='bar baz'] Layout (string='foo')"
expected= {'Layout':
{'plot':
Options(foo='bar baz', fig_inches=(3, 3)),
'style': Options(string='foo')}}
self.assertEqual(OptsSpec.parse(line), expected)
示例4: test_style_opts_advanced
# 需要导入模块: from holoviews.util.parser import OptsSpec [as 别名]
# 或者: from holoviews.util.parser.OptsSpec import parse [as 别名]
def test_style_opts_advanced(self):
line = "Layout (string='foo' test=3, b=True color=Cycle(values=[1,2]))"
expected= {'Layout':{
'style': Options(string='foo',
test=3,
b=True,
color=Cycle(values=[1,2]))}}
self.assertEqual(OptsSpec.parse(line), expected)
示例5: test_norm_opts_multiple_paths
# 需要导入模块: from holoviews.util.parser import OptsSpec [as 别名]
# 或者: from holoviews.util.parser.OptsSpec import parse [as 别名]
def test_norm_opts_multiple_paths(self):
line = "Image Curve {+axiswise +framewise}"
expected = {'Image':
{'norm':
Options(axiswise=True, framewise=True)},
'Curve':
{'norm':
Options(axiswise=True, framewise=True)}}
self.assertEqual(OptsSpec.parse(line), expected)
示例6: test_combined_two_types_2
# 需要导入模块: from holoviews.util.parser import OptsSpec [as 别名]
# 或者: from holoviews.util.parser.OptsSpec import parse [as 别名]
def test_combined_two_types_2(self):
line = "Layout plot[fig_inches=(3, 3)] Image (string='foo') [foo='bar baz']"
expected= {'Layout':
{'plot':
Options(fig_inches=(3, 3))},
'Image': {
'style': Options(string='foo'),
'plot': Options(foo='bar baz')}}
self.assertEqual(OptsSpec.parse(line), expected)
示例7: test_plot_opts_multiple_paths
# 需要导入模块: from holoviews.util.parser import OptsSpec [as 别名]
# 或者: from holoviews.util.parser.OptsSpec import parse [as 别名]
def test_plot_opts_multiple_paths(self):
line = "Image Curve [fig_inches=(3, 3) title_format='foo bar']"
expected = {'Image':
{'plot':
Options(title_format='foo bar', fig_inches=(3, 3))},
'Curve':
{'plot':
Options(title_format='foo bar', fig_inches=(3, 3))}}
self.assertEqual(OptsSpec.parse(line), expected)
示例8: test_style_opts_multiple_paths
# 需要导入模块: from holoviews.util.parser import OptsSpec [as 别名]
# 或者: from holoviews.util.parser.OptsSpec import parse [as 别名]
def test_style_opts_multiple_paths(self):
line = "Image Curve (color='beautiful')"
expected = {'Image':
{'style':
Options(color='beautiful')},
'Curve':
{'style':
Options(color='beautiful')}}
self.assertEqual(OptsSpec.parse(line), expected)
示例9: test_combined_multiple_paths_merge
# 需要导入模块: from holoviews.util.parser import OptsSpec [as 别名]
# 或者: from holoviews.util.parser.OptsSpec import parse [as 别名]
def test_combined_multiple_paths_merge(self):
line = "Image Curve [fig_inches=(3, 3)] (c='b') Image (s=3)"
expected = {'Image':
{'plot':
Options(fig_inches=(3, 3)),
'style':
Options(c='b', s=3)},
'Curve':
{'plot':
Options(fig_inches=(3, 3)),
'style':
Options(c='b')}}
self.assertEqual(OptsSpec.parse(line), expected)
示例10: test_plot_opts_multiple_paths_2
# 需要导入模块: from holoviews.util.parser import OptsSpec [as 别名]
# 或者: from holoviews.util.parser.OptsSpec import parse [as 别名]
def test_plot_opts_multiple_paths_2(self):
line = "Image Curve Layout Overlay[fig_inches=(3, 3) title='foo bar']"
expected = {'Image':
{'plot':
Options(title='foo bar', fig_inches=(3, 3))},
'Curve':
{'plot':
Options(title='foo bar', fig_inches=(3, 3))},
'Layout':
{'plot':
Options(title='foo bar', fig_inches=(3, 3))},
'Overlay':
{'plot':
Options(title='foo bar', fig_inches=(3, 3))}}
self.assertEqual(OptsSpec.parse(line), expected)
示例11: test_style_opts_cycle_function
# 需要导入模块: from holoviews.util.parser import OptsSpec [as 别名]
# 或者: from holoviews.util.parser.OptsSpec import parse [as 别名]
def test_style_opts_cycle_function(self):
# Explicitly compare because list of arrays do not compare correctly
import numpy as np
np.random.seed(42)
line = "Curve (color=Cycle(values=list(np.random.rand(3,3))))"
options = OptsSpec.parse(line, {'np': np, 'Cycle': Cycle})
self.assertTrue('Curve' in options)
self.assertTrue('style' in options['Curve'])
self.assertTrue('color' in options['Curve']['style'].kwargs)
self.assertTrue(isinstance(options['Curve']['style'].kwargs['color'], Cycle))
values = np.array([[ 0.37454012, 0.95071431, 0.73199394],
[ 0.59865848, 0.15601864, 0.15599452],
[ 0.05808361, 0.86617615, 0.60111501]])
self.assertEqual(np.array(options['Curve']['style'].kwargs['color'].values),
values)
示例12: test_combined_multiple_paths
# 需要导入模块: from holoviews.util.parser import OptsSpec [as 别名]
# 或者: from holoviews.util.parser.OptsSpec import parse [as 别名]
def test_combined_multiple_paths(self):
line = "Image Curve {+framewise} [fig_inches=(3, 3) title_format='foo bar'] (c='b') Layout [string='foo'] Overlay"
expected = {'Image':
{'norm':
Options(framewise=True, axiswise=False),
'plot':
Options(title_format='foo bar', fig_inches=(3, 3)),
'style':
Options(c='b')},
'Curve':
{'norm':
Options(framewise=True, axiswise=False),
'plot':
Options(title_format='foo bar', fig_inches=(3, 3)),
'style':
Options(c='b')},
'Layout':
{'plot':
Options(string='foo')},
'Overlay':
{}}
self.assertEqual(OptsSpec.parse(line), expected)
示例13: test_plot_opts_nested_brackets
# 需要导入模块: from holoviews.util.parser import OptsSpec [as 别名]
# 或者: from holoviews.util.parser.OptsSpec import parse [as 别名]
def test_plot_opts_nested_brackets(self):
line = "Curve [title_format=', '.join(('A', 'B'))]"
expected = {'Curve': {'plot': Options(title_format='A, B')}}
self.assertEqual(OptsSpec.parse(line), expected)
示例14: test_plot_opts_dict_without_space
# 需要导入模块: from holoviews.util.parser import OptsSpec [as 别名]
# 或者: from holoviews.util.parser.OptsSpec import parse [as 别名]
def test_plot_opts_dict_without_space(self):
line = "Curve [fontsize=dict(xlabel=10,title=20)]"
expected = {'Curve': {'plot': Options(fontsize={'xlabel': 10, 'title': 20})}}
self.assertEqual(OptsSpec.parse(line), expected)
示例15: test_plot_opts_with_space_explicit
# 需要导入模块: from holoviews.util.parser import OptsSpec [as 别名]
# 或者: from holoviews.util.parser.OptsSpec import parse [as 别名]
def test_plot_opts_with_space_explicit(self):
line = "Layout plot[fig_inches=(3, 3) title_format='foo bar']"
expected= {'Layout':
{'plot':
Options(title_format='foo bar', fig_inches=(3, 3))}}
self.assertEqual(OptsSpec.parse(line), expected)