本文整理汇总了Python中holoviews.Store.set_current_backend方法的典型用法代码示例。如果您正苦于以下问题:Python Store.set_current_backend方法的具体用法?Python Store.set_current_backend怎么用?Python Store.set_current_backend使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类holoviews.Store
的用法示例。
在下文中一共展示了Store.set_current_backend方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_builder_cross_backend_validation
# 需要导入模块: from holoviews import Store [as 别名]
# 或者: from holoviews.Store import set_current_backend [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)
示例2: setUp
# 需要导入模块: from holoviews import Store [as 别名]
# 或者: from holoviews.Store import set_current_backend [as 别名]
def setUp(self):
if 'matplotlib' not in Store.renderers:
raise SkipTest('Matplotlib backend not available.')
self.store_copy = OptionTree(sorted(Store.options().items()),
groups=Options._option_groups)
self.backend = 'matplotlib'
Store.set_current_backend(self.backend)
super(TestOptsMethod, self).setUp()
示例3: test_mpl_bokeh_mpl_via_builders_opts_method_implicit_backend
# 需要导入模块: from holoviews import Store [as 别名]
# 或者: from holoviews.Store import set_current_backend [as 别名]
def test_mpl_bokeh_mpl_via_builders_opts_method_implicit_backend(self):
img = Image(np.random.rand(10,10))
Store.set_current_backend('matplotlib')
mpl_opts = opts.Image(cmap='Blues')
bokeh_opts = opts.Image(cmap='Purple', backend='bokeh')
self.assertEqual('backend' not in mpl_opts.kwargs, True)
self.assertEqual(bokeh_opts.kwargs['backend'], 'bokeh')
img.opts(mpl_opts, bokeh_opts)
mpl_lookup = Store.lookup_options('matplotlib', img, 'style').options
self.assertEqual(mpl_lookup['cmap'], 'Blues')
bokeh_lookup = Store.lookup_options('bokeh', img, 'style').options
self.assertEqual(bokeh_lookup['cmap'], 'Purple')
self.assert_output_options_group_empty(img)
示例4: test_builder_backend_switch
# 需要导入模块: from holoviews import Store [as 别名]
# 或者: from holoviews.Store import set_current_backend [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)
示例5: test_mpl_bokeh_mpl_via_builders_opts_method_flat_literal_explicit_backend
# 需要导入模块: from holoviews import Store [as 别名]
# 或者: from holoviews.Store import set_current_backend [as 别名]
def test_mpl_bokeh_mpl_via_builders_opts_method_flat_literal_explicit_backend(self):
img = Image(np.random.rand(10,10))
curve = Curve([1,2,3])
overlay = img * curve
Store.set_current_backend('matplotlib')
literal = {'Curve': dict(color='orange', backend='matplotlib'),
'Image': dict(cmap='jet', backend='bokeh')
}
styled = overlay.opts(literal)
mpl_curve_lookup = Store.lookup_options('matplotlib', styled.Curve.I, 'style')
self.assertEqual(mpl_curve_lookup.kwargs['color'], 'orange')
mpl_img_lookup = Store.lookup_options('matplotlib', styled.Image.I, 'style')
self.assertNotEqual(mpl_img_lookup.kwargs['cmap'], 'jet')
bokeh_curve_lookup = Store.lookup_options('bokeh', styled.Curve.I, 'style')
self.assertNotEqual(bokeh_curve_lookup.kwargs['color'], 'orange')
bokeh_img_lookup = Store.lookup_options('bokeh', styled.Image.I, 'style')
self.assertEqual(bokeh_img_lookup.kwargs['cmap'], 'jet')
示例6: noqa
# 需要导入模块: from holoviews import Store [as 别名]
# 或者: from holoviews.Store import set_current_backend [as 别名]
Contours, Graph, TriMesh, Nodes, EdgePaths,
QuadMesh, VectorField, HexTiles, Labels)
from .util import load_tiff, from_xarray # noqa (API import)
from .operation import project # noqa (API import)
from . import data # noqa (API import)
from . import operation # noqa (API import)
from . import plotting # noqa (API import)
from . import feature # noqa (API import)
from . import tile_sources # noqa (API import)
__version__ = str(param.version.Version(fpath=__file__, archive_commit="cc70ac2d",
reponame="geoviews"))
# Ensure opts utility is initialized with GeoViews elements
if Store._options:
Store.set_current_backend(Store.current_backend)
# make pyct's example/data commands available if possible
from functools import partial
try:
from pyct.cmd import copy_examples as _copy, fetch_data as _fetch, examples as _examples
copy_examples = partial(_copy, 'geoviews')
fetch_data = partial(_fetch, 'geoviews')
examples = partial(_examples, 'geoviews')
except ImportError:
def _missing_cmd(*args,**kw): return("install pyct to enable this command (e.g. `conda install -c pyviz pyct`)")
_copy = _fetch = _examples = _missing_cmd
def _err(): raise ValueError(_missing_cmd())
fetch_data = copy_examples = examples = _err
del partial, _examples, _copy, _fetch