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


Python holoviews.Scatter方法代码示例

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


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

示例1: plot_landscape

# 需要导入模块: import holoviews [as 别名]
# 或者: from holoviews import Scatter [as 别名]
def plot_landscape(data):
        """
        Plot the data as an energy landscape.

        Args:
            data: (x, y, xx, yy, z, xlim, ylim). x, y, z represent the \
                  coordinates of the points that will be interpolated. xx, yy \
                  represent the meshgrid used to interpolate the points. xlim, \
                  ylim are tuples containing the limits of the x and y axes.

        Returns:
            Plot representing the interpolated energy landscape of the target points.

        """
        x, y, xx, yy, z, xlim, ylim = data
        zz = griddata((x, y), z, (xx, yy), method="linear")
        mesh = holoviews.QuadMesh((xx, yy, zz))
        contour = holoviews.operation.contours(mesh, levels=8)
        scatter = holoviews.Scatter((x, y))
        contour_mesh = mesh * contour * scatter
        return contour_mesh.redim(
            x=holoviews.Dimension("x", range=xlim), y=holoviews.Dimension("y", range=ylim),
        ) 
开发者ID:FragileTech,项目名称:fragile,代码行数:25,代码来源:streaming.py

示例2: test_to_element

# 需要导入模块: import holoviews [as 别名]
# 或者: from holoviews import Scatter [as 别名]
def test_to_element(self):
        curve = self.ds.to(Curve, 'a', 'b', groupby=[])
        curve2 = self.ds2.to(Curve, 'a', 'b', groupby=[])
        self.assertNotEqual(curve, curve2)

        self.assertEqual(curve.dataset, self.ds)

        scatter = curve.to(Scatter)
        self.assertEqual(scatter.dataset, self.ds)

        # Check pipeline
        ops = curve.pipeline.operations
        self.assertEqual(len(ops), 2)
        self.assertIs(ops[0].output_type, Dataset)
        self.assertIs(ops[1].output_type, Curve)

        # Execute pipeline
        self.assertEqual(curve.pipeline(curve.dataset), curve)
        self.assertEqual(
            curve.pipeline(self.ds2), curve2
        ) 
开发者ID:holoviz,项目名称:holoviews,代码行数:23,代码来源:testdatasetproperty.py

示例3: test_apply_curve

# 需要导入模块: import holoviews [as 别名]
# 或者: from holoviews import Scatter [as 别名]
def test_apply_curve(self):
        curve = self.ds.to.curve('a', 'b', groupby=[]).apply(
            lambda c: Scatter(c.select(b=(20, None)).data)
        )
        curve2 = self.ds2.to.curve('a', 'b', groupby=[]).apply(
            lambda c: Scatter(c.select(b=(20, None)).data)
        )
        self.assertNotEqual(curve, curve2)

        # Check pipeline
        ops = curve.pipeline.operations
        self.assertEqual(len(ops), 4)
        self.assertIs(ops[0].output_type, Dataset)
        self.assertIs(ops[1].output_type, Curve)
        self.assertIs(ops[2].output_type, Apply)
        self.assertEqual(ops[2].kwargs, {'mode': None})
        self.assertEqual(ops[3].method_name, '__call__')

        # Execute pipeline
        self.assertEqual(curve.pipeline(curve.dataset), curve)
        self.assertEqual(
            curve.pipeline(self.ds2), curve2
        ) 
开发者ID:holoviz,项目名称:holoviews,代码行数:25,代码来源:testdatasetproperty.py

示例4: test_holoviews_pane_mpl_renderer

# 需要导入模块: import holoviews [as 别名]
# 或者: from holoviews import Scatter [as 别名]
def test_holoviews_pane_mpl_renderer(document, comm):
    curve = hv.Curve([1, 2, 3])
    pane = Pane(curve)

    # Create pane
    row = pane.get_root(document, comm=comm)
    assert isinstance(row, BkRow)
    assert len(row.children) == 1
    model = row.children[0]
    assert pane._models[row.ref['id']][0] is model
    assert model.text.startswith('<img src=')

    # Replace Pane.object
    scatter = hv.Scatter([1, 2, 3])
    pane.object = scatter
    new_model = row.children[0]
    assert model.text != new_model.text

    # Cleanup
    pane._cleanup(row)
    assert pane._models == {} 
开发者ID:holoviz,项目名称:panel,代码行数:23,代码来源:test_holoviews.py

示例5: plot_landscape

# 需要导入模块: import holoviews [as 别名]
# 或者: from holoviews import Scatter [as 别名]
def plot_landscape(data):
        """Plot the walkers distribution overlaying a histogram on a bivariate plot."""
        X, x, y, xlim, ylim = data
        mesh = holoviews.Bivariate(X)
        scatter = holoviews.Scatter((x, y))
        contour_mesh = mesh * scatter
        return contour_mesh.redim(
            x=holoviews.Dimension("x", range=xlim), y=holoviews.Dimension("y", range=ylim),
        ) 
开发者ID:FragileTech,项目名称:fragile,代码行数:11,代码来源:swarm_stats.py

示例6: test_attempt_to_override_kind_on_method

# 需要导入模块: import holoviews [as 别名]
# 或者: from holoviews import Scatter [as 别名]
def test_attempt_to_override_kind_on_method(self):
        hvplot = hvPlotTabular(self.df, {'scatter': {'kind': 'line'}})
        self.assertIsInstance(hvplot.scatter(y='y'), Scatter) 
开发者ID:holoviz,项目名称:hvplot,代码行数:5,代码来源:testoverrides.py

示例7: test_rolling_outliers_std_ints

# 需要导入模块: import holoviews [as 别名]
# 或者: from holoviews import Scatter [as 别名]
def test_rolling_outliers_std_ints(self):
        outliers = rolling_outlier_std(self.int_outliers, rolling_window=2, sigma=1)
        self.assertEqual(outliers, Scatter([(4, 10)])) 
开发者ID:holoviz,项目名称:holoviews,代码行数:5,代码来源:testtimeseriesoperations.py

示例8: test_rolling_outliers_std_dates

# 需要导入模块: import holoviews [as 别名]
# 或者: from holoviews import Scatter [as 别名]
def test_rolling_outliers_std_dates(self):
        outliers = rolling_outlier_std(self.date_outliers, rolling_window=2, sigma=1)
        self.assertEqual(outliers, Scatter([(pd.Timestamp("2016-01-05"), 10)])) 
开发者ID:holoviz,项目名称:holoviews,代码行数:5,代码来源:testtimeseriesoperations.py

示例9: setUp

# 需要导入模块: import holoviews [as 别名]
# 或者: from holoviews import Scatter [as 别名]
def setUp(self):
        "Variations on the constructors in the Elements notebook"

        self.scatter1 = Scatter([(1, i) for i in range(20)])
        self.scatter2 = Scatter([(1, i) for i in range(21)])
        self.scatter3 = Scatter([(1, i*2) for i in range(20)]) 
开发者ID:holoviz,项目名称:holoviews,代码行数:8,代码来源:testcomparisonchart.py

示例10: test_scatter_unequal_data_shape

# 需要导入模块: import holoviews [as 别名]
# 或者: from holoviews import Scatter [as 别名]
def test_scatter_unequal_data_shape(self):
        try:
            self.assertEqual(self.scatter1, self.scatter2)
        except  AssertionError as e:
            if not str(e).startswith("Scatter not of matching length, 20 vs. 21."):
                raise self.failureException("Scatter data mismatch error not raised.") 
开发者ID:holoviz,项目名称:holoviews,代码行数:8,代码来源:testcomparisonchart.py

示例11: test_scatter_ellipsis_value

# 需要导入模块: import holoviews [as 别名]
# 或者: from holoviews import Scatter [as 别名]
def test_scatter_ellipsis_value(self):
        hv.Scatter(range(10))[...,'y'] 
开发者ID:holoviz,项目名称:holoviews,代码行数:4,代码来源:testellipsis.py

示例12: test_scatter_ellipsis_value_missing

# 需要导入模块: import holoviews [as 别名]
# 或者: from holoviews import Scatter [as 别名]
def test_scatter_ellipsis_value_missing(self):
        try:
            hv.Scatter(range(10))[...,'Non-existent']
        except Exception as e:
            if str(e) != "'Non-existent' is not an available value dimension":
                raise AssertionError("Incorrect exception raised.") 
开发者ID:holoviz,项目名称:holoviews,代码行数:8,代码来源:testellipsis.py

示例13: test_holoviews_pane_bokeh_renderer

# 需要导入模块: import holoviews [as 别名]
# 或者: from holoviews import Scatter [as 别名]
def test_holoviews_pane_bokeh_renderer(document, comm):
    curve = hv.Curve([1, 2, 3])
    pane = Pane(curve)

    # Create pane
    row = pane.get_root(document, comm=comm)
    assert isinstance(row, BkRow)
    assert len(row.children) == 1
    model = row.children[0]
    assert isinstance(model, Figure)
    assert pane._models[row.ref['id']][0] is model
    renderers = [r for r in model.renderers if isinstance(r, GlyphRenderer)]
    assert len(renderers) == 1
    assert isinstance(renderers[0].glyph, Line)

    # Replace Pane.object
    scatter = hv.Scatter([1, 2, 3])
    pane.object = scatter
    model = row.children[0]
    assert isinstance(model, Figure)
    renderers = [r for r in model.renderers if isinstance(r, GlyphRenderer)]
    assert len(renderers) == 1
    assert isinstance(renderers[0].glyph, Scatter)
    assert pane._models[row.ref['id']][0] is model

    # Cleanup
    pane._cleanup(row)
    assert pane._models == {} 
开发者ID:holoviz,项目名称:panel,代码行数:30,代码来源:test_holoviews.py

示例14: opts

# 需要导入模块: import holoviews [as 别名]
# 或者: from holoviews import Scatter [as 别名]
def opts(
        self,
        title="",
        xlabel: str = "x",
        ylabel: str = "y",
        framewise: bool = True,
        axiswise: bool = True,
        normalize: bool = True,
        *args,
        **kwargs
    ):
        """
        Update the plot parameters. Same as ``holoviews`` ``opts``.

        The default values updates the plot axes independently when being \
        displayed in a :class:`Holomap`.
        """
        kwargs = self.update_kwargs(**kwargs)
        # Add specific defaults to Scatter
        scatter_kwargs = dict(kwargs)
        if Store.current_backend == "bokeh":
            scatter_kwargs["size"] = scatter_kwargs.get("size", 3.5)
        elif Store.current_backend == "matplotlib":
            scatter_kwargs["s"] = scatter_kwargs.get("s", 15)
        self.plot = self.plot.opts(
            holoviews.opts.Bivariate(
                title=title,
                xlabel=xlabel,
                ylabel=ylabel,
                framewise=framewise,
                axiswise=axiswise,
                normalize=normalize,
                *args,
                **kwargs
            ),
            holoviews.opts.Scatter(
                alpha=0.7,
                xlabel=xlabel,
                ylabel=ylabel,
                framewise=framewise,
                axiswise=axiswise,
                normalize=normalize,
                *args,
                **scatter_kwargs
            ),
            holoviews.opts.NdOverlay(normalize=normalize, framewise=framewise, axiswise=axiswise,),
        ) 
开发者ID:FragileTech,项目名称:fragile,代码行数:49,代码来源:streaming.py

示例15: opts

# 需要导入模块: import holoviews [as 别名]
# 或者: from holoviews import Scatter [as 别名]
def opts(
        self,
        title="Walkers density distribution",
        xlabel: str = "x",
        ylabel: str = "y",
        framewise: bool = True,
        axiswise: bool = True,
        normalize: bool = True,
        *args,
        **kwargs
    ):
        """
        Update the plot parameters. Same as ``holoviews`` ``opts``.

        The default values updates the plot axes independently when being \
        displayed in a :class:`Holomap`.
        """
        kwargs = self.update_kwargs(**kwargs)
        # Add specific defaults to Scatter
        scatter_kwargs = dict(kwargs)
        if Store.current_backend == "bokeh":
            scatter_kwargs["fill_color"] = scatter_kwargs.get("fill_color", "red")
            scatter_kwargs["size"] = scatter_kwargs.get("size", 3.5)
        elif Store.current_backend == "matplotlib":
            scatter_kwargs["color"] = scatter_kwargs.get("color", "red")
            scatter_kwargs["s"] = scatter_kwargs.get("s", 15)
        self.plot = self.plot.opts(
            holoviews.opts.Bivariate(
                title=title,
                xlabel=xlabel,
                ylabel=ylabel,
                framewise=framewise,
                axiswise=axiswise,
                normalize=normalize,
                show_legend=False,
                colorbar=True,
                filled=True,
                *args,
                **kwargs
            ),
            holoviews.opts.Scatter(
                alpha=0.7,
                xlabel=xlabel,
                ylabel=ylabel,
                framewise=framewise,
                axiswise=axiswise,
                normalize=normalize,
                *args,
                **scatter_kwargs
            ),
            holoviews.opts.NdOverlay(normalize=normalize, framewise=framewise, axiswise=axiswise,),
        ) 
开发者ID:FragileTech,项目名称:fragile,代码行数:54,代码来源:swarm_stats.py


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