本文整理汇总了Python中holoviews.HoloMap方法的典型用法代码示例。如果您正苦于以下问题:Python holoviews.HoloMap方法的具体用法?Python holoviews.HoloMap怎么用?Python holoviews.HoloMap使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类holoviews
的用法示例。
在下文中一共展示了holoviews.HoloMap方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_holoviews_with_widgets
# 需要导入模块: import holoviews [as 别名]
# 或者: from holoviews import HoloMap [as 别名]
def test_holoviews_with_widgets(document, comm):
hmap = hv.HoloMap({(i, chr(65+i)): hv.Curve([i]) for i in range(3)}, kdims=['X', 'Y'])
hv_pane = HoloViews(hmap)
layout = hv_pane.get_root(document, comm)
model = layout.children[0]
assert len(hv_pane.widget_box.objects) == 2
assert hv_pane.widget_box.objects[0].name == 'X'
assert hv_pane.widget_box.objects[1].name == 'Y'
assert hv_pane._models[layout.ref['id']][0] is model
hmap = hv.HoloMap({(i, chr(65+i)): hv.Curve([i]) for i in range(3)}, kdims=['A', 'B'])
hv_pane.object = hmap
assert len(hv_pane.widget_box.objects) == 2
assert hv_pane.widget_box.objects[0].name == 'A'
assert hv_pane.widget_box.objects[1].name == 'B'
示例2: test_holoviews_with_widgets_not_shown
# 需要导入模块: import holoviews [as 别名]
# 或者: from holoviews import HoloMap [as 别名]
def test_holoviews_with_widgets_not_shown(document, comm):
hmap = hv.HoloMap({(i, chr(65+i)): hv.Curve([i]) for i in range(3)}, kdims=['X', 'Y'])
hv_pane = HoloViews(hmap, show_widgets=False)
layout_obj = Column(hv_pane, hv_pane.widget_box)
layout = layout_obj.get_root(document, comm)
model = layout.children[0]
assert len(hv_pane.widget_box.objects) == 2
assert hv_pane.widget_box.objects[0].name == 'X'
assert hv_pane.widget_box.objects[1].name == 'Y'
assert hv_pane._models[layout.ref['id']][0] is model
hmap = hv.HoloMap({(i, chr(65+i)): hv.Curve([i]) for i in range(3)}, kdims=['A', 'B'])
hv_pane.object = hmap
assert len(hv_pane.widget_box.objects) == 2
assert hv_pane.widget_box.objects[0].name == 'A'
assert hv_pane.widget_box.objects[1].name == 'B'
示例3: plot_data
# 需要导入模块: import holoviews [as 别名]
# 或者: from holoviews import HoloMap [as 别名]
def plot_data(self, feature_name):
""" Plots the FeatureType.DATA of eopatch.
:param feature_name: name of the eopatch feature
:type feature_name: str
:return: visualization
:rtype: holoview/geoviews/bokeh
"""
crs = self.eopatch.bbox.crs
crs = CRS.POP_WEB if crs is CRS.WGS84 else crs
data_da = array_to_dataframe(self.eopatch, (FeatureType.DATA, feature_name), crs=crs)
if self.mask:
data_da = self.mask_data(data_da)
timestamps = self.eopatch.timestamp
crs = self.eopatch.bbox.crs
if not self.rgb:
return data_da.hvplot(x='x', y='y', crs=ccrs.epsg(crs.epsg))
data_rgb = self.eopatch_da_to_rgb(data_da, feature_name, crs)
rgb_dict = {timestamp_: self.plot_rgb_one(data_rgb, timestamp_) for timestamp_ in timestamps}
return hv.HoloMap(rgb_dict, kdims=['time'])
示例4: plot_vector
# 需要导入模块: import holoviews [as 别名]
# 或者: from holoviews import HoloMap [as 别名]
def plot_vector(self, feature_name):
""" Visualizaton for vector (FeatureType.VECTOR) data
:param feature_name: name of eopatch feature
:type feature_name: str
:return: visualization
:rtype: holoviews/geoviews/bokeh
"""
crs = self.eopatch.bbox.crs
timestamps = self.eopatch.timestamp
data_gpd = self.fill_vector(FeatureType.VECTOR, feature_name)
if crs is CRS.WGS84:
crs = CRS.POP_WEB
data_gpd = data_gpd.to_crs(crs.pyproj_crs())
shapes_dict = {timestamp_: self.plot_shapes_one(data_gpd, timestamp_, crs)
for timestamp_ in timestamps}
return hv.HoloMap(shapes_dict, kdims=['time'])
示例5: generate_holo_map
# 需要导入模块: import holoviews [as 别名]
# 或者: from holoviews import HoloMap [as 别名]
def generate_holo_map(rgb_images, height, width):
frame_map = {}
for i, image in enumerate(rgb_images):
# print('image type: ' + str(type(image)))
hv_rgb = hv.RGB(np.array(image))
shape = image.shape
frame_map[i] = hv_rgb
holomap = hv.HoloMap(frame_map)
holomap = holomap.options(width=int(width), height=int(height))
return holomap
示例6: setUp
# 需要导入模块: import holoviews [as 别名]
# 或者: from holoviews import HoloMap [as 别名]
def setUp(self):
if 'bokeh' not in Store.renderers and pn is not None:
raise SkipTest("Bokeh and Panel required to test 'bokeh' renderer")
self.image1 = Image(np.array([[0,1],[2,3]]), label='Image1')
self.image2 = Image(np.array([[1,0],[4,-2]]), label='Image2')
self.map1 = HoloMap({1:self.image1, 2:self.image2}, label='TestMap')
self.renderer = BokehRenderer.instance()
self.nbcontext = Renderer.notebook_context
self.comm_manager = Renderer.comm_manager
with param.logging_level('ERROR'):
Renderer.notebook_context = False
Renderer.comm_manager = CommManager
示例7: test_render_holomap_individual
# 需要导入模块: import holoviews [as 别名]
# 或者: from holoviews import HoloMap [as 别名]
def test_render_holomap_individual(self):
hmap = HoloMap({i: Curve([1, 2, i]) for i in range(5)})
obj, _ = self.renderer._validate(hmap, None)
self.assertIsInstance(obj, pn.pane.HoloViews)
self.assertEqual(obj.center, True)
self.assertEqual(obj.widget_location, 'right')
self.assertEqual(obj.widget_type, 'individual')
widgets = obj.layout.select(DiscreteSlider)
self.assertEqual(len(widgets), 1)
slider = widgets[0]
self.assertEqual(slider.options, OrderedDict([(str(i), i) for i in range(5)]))
示例8: test_render_holomap_embedded
# 需要导入模块: import holoviews [as 别名]
# 或者: from holoviews import HoloMap [as 别名]
def test_render_holomap_embedded(self):
hmap = HoloMap({i: Curve([1, 2, i]) for i in range(5)})
data, _ = self.renderer.components(hmap)
self.assertIn('State"', data['text/html'])
示例9: test_render_holomap_not_embedded
# 需要导入模块: import holoviews [as 别名]
# 或者: from holoviews import HoloMap [as 别名]
def test_render_holomap_not_embedded(self):
hmap = HoloMap({i: Curve([1, 2, i]) for i in range(5)})
data, _ = self.renderer.instance(widget_mode='live').components(hmap)
self.assertNotIn('State"', data['text/html'])
示例10: test_render_holomap_scrubber
# 需要导入模块: import holoviews [as 别名]
# 或者: from holoviews import HoloMap [as 别名]
def test_render_holomap_scrubber(self):
hmap = HoloMap({i: Curve([1, 2, i]) for i in range(5)})
obj, _ = self.renderer._validate(hmap, 'scrubber')
self.assertIsInstance(obj, pn.pane.HoloViews)
self.assertEqual(obj.center, True)
self.assertEqual(obj.widget_location, 'bottom')
self.assertEqual(obj.widget_type, 'scrubber')
widgets = obj.layout.select(Player)
self.assertEqual(len(widgets), 1)
player = widgets[0]
self.assertEqual(player.start, 0)
self.assertEqual(player.end, 4)
示例11: test_render_holomap_individual_widget_position
# 需要导入模块: import holoviews [as 别名]
# 或者: from holoviews import HoloMap [as 别名]
def test_render_holomap_individual_widget_position(self):
hmap = HoloMap({i: Curve([1, 2, i]) for i in range(5)})
obj, _ = self.renderer.instance(widget_location='top')._validate(hmap, None)
self.assertIsInstance(obj, pn.pane.HoloViews)
self.assertEqual(obj.center, True)
self.assertEqual(obj.widget_location, 'top')
self.assertEqual(obj.widget_type, 'individual')
示例12: test_deep_ellipsis_curve_slicing_1
# 需要导入模块: import holoviews [as 别名]
# 或者: from holoviews import HoloMap [as 别名]
def test_deep_ellipsis_curve_slicing_1(self):
hmap = hv.HoloMap({i:hv.Curve([(j,j) for j in range(10)])
for i in range(10)})
sliced = hmap[2:5,...]
self.assertEqual(sliced.keys(), [2, 3, 4])
示例13: test_deep_ellipsis_curve_slicing_2
# 需要导入模块: import holoviews [as 别名]
# 或者: from holoviews import HoloMap [as 别名]
def test_deep_ellipsis_curve_slicing_2(self):
hmap = hv.HoloMap({i:hv.Curve([(j,j) for j in range(10)])
for i in range(10)})
sliced = hmap[2:5,1:8,...]
self.assertEqual(sliced.last.range('x'), (1,7))
示例14: test_deep_ellipsis_curve_slicing_3
# 需要导入模块: import holoviews [as 别名]
# 或者: from holoviews import HoloMap [as 别名]
def test_deep_ellipsis_curve_slicing_3(self):
hmap = hv.HoloMap({i:hv.Curve([(j,2*j) for j in range(10)])
for i in range(10)})
sliced = hmap[...,2:5]
self.assertEqual(sliced.last.range('y'), (2, 4))
示例15: test_unique_keys_complete_overlap
# 需要导入模块: import holoviews [as 别名]
# 或者: from holoviews import HoloMap [as 别名]
def test_unique_keys_complete_overlap(self):
hmap1 = HoloMap({i: Curve(range(10)) for i in range(5)})
hmap2 = HoloMap({i: Curve(range(10)) for i in range(3, 10)})
dims, keys = unique_dimkeys(hmap1+hmap2)
self.assertEqual(hmap1.kdims, dims)
self.assertEqual(keys, [(i,) for i in range(10)])