当前位置: 首页>>代码示例>>Python>>正文


Python holoviews.NdOverlay方法代码示例

本文整理汇总了Python中holoviews.NdOverlay方法的典型用法代码示例。如果您正苦于以下问题:Python holoviews.NdOverlay方法的具体用法?Python holoviews.NdOverlay怎么用?Python holoviews.NdOverlay使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在holoviews的用法示例。


在下文中一共展示了holoviews.NdOverlay方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _pos_indicator

# 需要导入模块: import holoviews [as 别名]
# 或者: from holoviews import NdOverlay [as 别名]
def _pos_indicator(self, obj, x):
        """
        Returns an NdOverlay of Points indicating the current
        mouse position along the cross-sections.

        Note: Because the function returns an NdOverlay containing
        a variable number of elements batching must be enabled and
        the legend_limit must be set to 0.
        """
        points = []
        elements = obj or []
        for el in elements:
            if len(el)<1:
                continue
            p = Points(el[x], ['x', 'y'], crs=ccrs.GOOGLE_MERCATOR)
            points.append(p)
        if not points:
            return NdOverlay({0: Points([], ['x', 'y'])})
        return NdOverlay(enumerate(points)) 
开发者ID:pyviz-topics,项目名称:EarthSim,代码行数:21,代码来源:analysis.py

示例2: test_dynamic_compute_overlayable_zorders_mixed_dynamic_and_non_dynamic_ndoverlays

# 需要导入模块: import holoviews [as 别名]
# 或者: from holoviews import NdOverlay [as 别名]
def test_dynamic_compute_overlayable_zorders_mixed_dynamic_and_non_dynamic_ndoverlays(self):
        ndoverlay = NdOverlay({i: Area(range(10+i)) for i in range(2)})
        curve = DynamicMap(lambda: Curve(range(10)), kdims=[])
        curve_redim = curve.redim(x='x2')
        combined = ndoverlay*curve_redim
        combined[()]
        sources = compute_overlayable_zorders(combined)

        self.assertIn(ndoverlay[0], sources[0])
        self.assertIn(ndoverlay, sources[0])
        self.assertNotIn(curve_redim, sources[0])
        self.assertNotIn(curve, sources[0])

        self.assertIn(ndoverlay[1], sources[1])
        self.assertIn(ndoverlay, sources[1])
        self.assertNotIn(curve_redim, sources[1])
        self.assertNotIn(curve, sources[1])

        self.assertIn(curve_redim, sources[2])
        self.assertIn(curve, sources[2])
        self.assertNotIn(ndoverlay, sources[2]) 
开发者ID:holoviz,项目名称:holoviews,代码行数:23,代码来源:testplotutils.py

示例3: test_dynamic_compute_overlayable_zorders_mixed_dynamic_and_dynamic_ndoverlay_with_streams

# 需要导入模块: import holoviews [as 别名]
# 或者: from holoviews import NdOverlay [as 别名]
def test_dynamic_compute_overlayable_zorders_mixed_dynamic_and_dynamic_ndoverlay_with_streams(self):
        ndoverlay = DynamicMap(lambda x: NdOverlay({i: Area(range(10+i)) for i in range(2)}),
                               kdims=[], streams=[PointerX()])
        curve = DynamicMap(lambda: Curve(range(10)), kdims=[])
        curve_redim = curve.redim(x='x2')
        combined = ndoverlay*curve_redim
        combined[()]
        sources = compute_overlayable_zorders(combined)

        self.assertIn(ndoverlay, sources[0])
        self.assertNotIn(curve_redim, sources[0])
        self.assertNotIn(curve, sources[0])

        self.assertIn(ndoverlay, sources[1])
        self.assertNotIn(curve_redim, sources[1])
        self.assertNotIn(curve, sources[1])

        self.assertIn(curve_redim, sources[2])
        self.assertIn(curve, sources[2])
        self.assertNotIn(ndoverlay, sources[2]) 
开发者ID:holoviz,项目名称:holoviews,代码行数:22,代码来源:testplotutils.py

示例4: test_dynamic_compute_overlayable_zorders_mixed_dynamic_and_dynamic_ndoverlay_with_streams_cloned

# 需要导入模块: import holoviews [as 别名]
# 或者: from holoviews import NdOverlay [as 别名]
def test_dynamic_compute_overlayable_zorders_mixed_dynamic_and_dynamic_ndoverlay_with_streams_cloned(self):
        ndoverlay = DynamicMap(lambda x: NdOverlay({i: Area(range(10+i)) for i in range(2)}),
                               kdims=[], streams=[PointerX()])
        curve = DynamicMap(lambda: Curve(range(10)), kdims=[])
        curve_redim = curve.redim(x='x2')
        combined = ndoverlay*curve_redim
        combined[()]
        sources = compute_overlayable_zorders(combined.clone())

        self.assertIn(ndoverlay, sources[0])
        self.assertNotIn(curve_redim, sources[0])
        self.assertNotIn(curve, sources[0])

        self.assertIn(ndoverlay, sources[1])
        self.assertNotIn(curve_redim, sources[1])
        self.assertNotIn(curve, sources[1])

        self.assertIn(curve_redim, sources[2])
        self.assertIn(curve, sources[2])
        self.assertNotIn(ndoverlay, sources[2]) 
开发者ID:holoviz,项目名称:holoviews,代码行数:22,代码来源:testplotutils.py

示例5: test_dynamic_compute_overlayable_zorders_mixed_dynamic_and_non_dynamic_ndoverlays_reverse

# 需要导入模块: import holoviews [as 别名]
# 或者: from holoviews import NdOverlay [as 别名]
def test_dynamic_compute_overlayable_zorders_mixed_dynamic_and_non_dynamic_ndoverlays_reverse(self):
        ndoverlay = NdOverlay({i: Area(range(10+i)) for i in range(2)})
        curve = DynamicMap(lambda: Curve(range(10)), kdims=[])
        curve_redim = curve.redim(x='x2')
        combined = curve_redim*ndoverlay
        combined[()]
        sources = compute_overlayable_zorders(combined)

        self.assertIn(curve_redim, sources[0])
        self.assertIn(curve, sources[0])
        self.assertNotIn(ndoverlay, sources[0])

        self.assertIn(ndoverlay[0], sources[1])
        self.assertIn(ndoverlay, sources[1])
        self.assertNotIn(curve_redim, sources[1])
        self.assertNotIn(curve, sources[1])

        self.assertIn(ndoverlay[1], sources[2])
        self.assertIn(ndoverlay, sources[2])
        self.assertNotIn(curve_redim, sources[2])
        self.assertNotIn(curve, sources[2]) 
开发者ID:holoviz,项目名称:holoviews,代码行数:23,代码来源:testplotutils.py

示例6: datashade_ndcurve

# 需要导入模块: import holoviews [as 别名]
# 或者: from holoviews import NdOverlay [as 别名]
def datashade_ndcurve(ovly, kdim=None, spread=False):
    if not kdim:
        kdim = ovly.kdims[0].name
    var = np.unique(ovly.dimension_values(kdim)).tolist()
    color_key = [(v, Category10_10[iv]) for iv, v in enumerate(var)]
    color_pts = hv.NdOverlay(
        {k: hv.Points([0, 0], label=str(k)).opts(style=dict(color=v)) for k, v in color_key})
    ds_ovly = datashade(
        ovly,
        aggregator=count_cat(kdim),
        color_key=dict(color_key),
        min_alpha=200,
        normalization='linear')
    if spread:
        ds_ovly = dynspread(ds_ovly)
    return ds_ovly * color_pts 
开发者ID:DeniseCaiLab,项目名称:minian,代码行数:18,代码来源:visualization.py

示例7: _sample

# 需要导入模块: import holoviews [as 别名]
# 或者: from holoviews import NdOverlay [as 别名]
def _sample(self, obj, data):
        """
        Rasterizes the supplied object in the current region
        and samples it with the drawn paths returning an
        NdOverlay of Curves.

        Note: Because the function returns an NdOverlay containing
        a variable number of elements batching must be enabled and
        the legend_limit must be set to 0.
        """
        if self.path_stream.data is None:
            path = self.path
        else:
            path = self.path_stream.element
        if isinstance(obj, TriMesh): 
            vdim = obj.nodes.vdims[0]
        else:
            vdim = obj.vdims[0]
        if len(path) > 2:
            x_range = path.range(0)
            y_range = path.range(1)
        else:
            return NdOverlay({0: Curve([], 'Distance', vdim)})

        (x0, x1), (y0, y1) = x_range, y_range
        width, height = (max([min([(x1-x0)/self.resolution, 500]), 10]),
                         max([min([(y1-y0)/self.resolution, 500]), 10]))
        raster = rasterize(obj, x_range=x_range, y_range=y_range,
                           aggregator=self.aggregator, width=int(width),
                           height=int(height), dynamic=False)
        x, y = raster.kdims
        sections = []
        for g in path.geom():
            xs, ys, distance = self._gen_samples(g)
            indexes = {x.name: xs, y.name: ys}
            points = raster.data.sel_points(method='nearest', **indexes).to_dataframe()
            points['Distance'] = distance
            sections.append(Curve(points, 'Distance', vdims=[vdim, x, y]))
        return NdOverlay(dict(enumerate(sections))) 
开发者ID:pyviz-topics,项目名称:EarthSim,代码行数:41,代码来源:analysis.py

示例8: test_plot

# 需要导入模块: import holoviews [as 别名]
# 或者: from holoviews import NdOverlay [as 别名]
def test_plot(sample1_datasource):
    pytest.importorskip('hvplot')
    import holoviews

    p = sample1_datasource.plot()
    assert isinstance(p, holoviews.NdOverlay) 
开发者ID:intake,项目名称:intake,代码行数:8,代码来源:test_csv.py

示例9: test_wide_chart

# 需要导入模块: import holoviews [as 别名]
# 或者: from holoviews import NdOverlay [as 别名]
def test_wide_chart(self, kind, element):
        plot = self.df.hvplot(kind=kind)
        obj = NdOverlay({'x': element(self.df, 'index', 'x').redim(x='value'),
                         'y': element(self.df, 'index', 'y').redim(y='value')}, 'Variable')
        self.assertEqual(plot, obj) 
开发者ID:holoviz,项目名称:hvplot,代码行数:7,代码来源:testcharts.py

示例10: test_wide_chart_labels

# 需要导入模块: import holoviews [as 别名]
# 或者: from holoviews import NdOverlay [as 别名]
def test_wide_chart_labels(self, kind, element):
        plot = self.df.hvplot(kind=kind, value_label='Test', group_label='Category')
        obj = NdOverlay({'x': element(self.df, 'index', 'x').redim(x='Test'),
                         'y': element(self.df, 'index', 'y').redim(y='Test')}, 'Category')
        self.assertEqual(plot, obj) 
开发者ID:holoviz,项目名称:hvplot,代码行数:7,代码来源:testcharts.py

示例11: test_tidy_chart_index_by

# 需要导入模块: import holoviews [as 别名]
# 或者: from holoviews import NdOverlay [as 别名]
def test_tidy_chart_index_by(self, kind, element):
        plot = self.df.hvplot(x='index', y='y', by='x', kind=kind)
        obj = NdOverlay({1: element(self.df[self.df.x==1], 'index', 'y'),
                         3: element(self.df[self.df.x==3], 'index', 'y'),
                         5: element(self.df[self.df.x==5], 'index', 'y')}, 'x')
        self.assertEqual(plot, obj) 
开发者ID:holoviz,项目名称:hvplot,代码行数:8,代码来源:testcharts.py

示例12: test_area_stacked

# 需要导入模块: import holoviews [as 别名]
# 或者: from holoviews import NdOverlay [as 别名]
def test_area_stacked(self):
        plot = self.df.hvplot.area(stacked=True)
        obj = NdOverlay({'x': Area(self.df, 'index', 'x').redim(x='value'),
                         'y': Area(self.df, 'index', 'y').redim(y='value')}, 'Variable')
        self.assertEqual(plot, Area.stack(obj)) 
开发者ID:holoviz,项目名称:hvplot,代码行数:7,代码来源:testcharts.py

示例13: test_only_includes_num_chart

# 需要导入模块: import holoviews [as 别名]
# 或者: from holoviews import NdOverlay [as 别名]
def test_only_includes_num_chart(self, kind, element):
        plot = self.cat_df.hvplot(kind=kind)
        obj = NdOverlay({'x': element(self.cat_df, 'index', 'x').redim(x='value'),
                         'y': element(self.cat_df, 'index', 'y').redim(y='value'),
                        }, 'Variable')
        self.assertEqual(plot, obj) 
开发者ID:holoviz,项目名称:hvplot,代码行数:8,代码来源:testcharts.py

示例14: setUp

# 需要导入模块: import holoviews [as 别名]
# 或者: from holoviews import NdOverlay [as 别名]
def setUp(self):
        self.dmap_element = DynamicMap(lambda: Image([]))
        self.dmap_overlay = DynamicMap(lambda: Overlay([Curve([]), Points([])]))
        self.dmap_ndoverlay = DynamicMap(lambda: NdOverlay({0: Curve([]), 1: Curve([])}))
        self.element = Scatter([])
        self.el1, self.el2 = Path([]), HLine(0)
        self.overlay = Overlay([self.el1, self.el2])
        self.ndoverlay = NdOverlay({0: VectorField([]), 1: VectorField([])}) 
开发者ID:holoviz,项目名称:holoviews,代码行数:10,代码来源:testplotutils.py

示例15: test_overlay

# 需要导入模块: import holoviews [as 别名]
# 或者: from holoviews import NdOverlay [as 别名]
def test_overlay(self):
        NdOverlay(list(enumerate([self.view1, self.view2, self.view3]))) 
开发者ID:holoviz,项目名称:holoviews,代码行数:4,代码来源:testlayers.py


注:本文中的holoviews.NdOverlay方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。