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


Python FigureFactory._trisurf方法代码示例

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


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

示例1: add_surface

# 需要导入模块: from plotly.tools import FigureFactory [as 别名]
# 或者: from plotly.tools.FigureFactory import _trisurf [as 别名]
    def add_surface(self, xyz, triangles, lighting=None, **kwargs):
        """Add a surface model to the plotly figure.

        xyz : array, shape (n_vertices, 3)
            An xyz array defining the position of each vertex in 3-D
        triangles : array, shape (n_triangles, 3)
            An ijk array defining triangles for the mesh. Each row
            indexes 3 rows of in xyz, which together make a triangle.
        lighting : None | dict
            A dictionary specifying lighting parameters in plotly
        """
        if lighting is None:
            lighting = dict(ambient=.4, specular=1)
        self.xyz = xyz
        self.x = xyz.T[0]
        self.y = xyz.T[1]
        self.z = xyz.T[2]
        self.triangles = triangles
        self.xrange = np.array([xyz.min(0)[0], xyz.max(0)[0]])
        self.yrange = np.array([xyz.min(0)[1], xyz.max(0)[1]])
        self.zrange = np.array([xyz.min(0)[2], xyz.max(0)[2]])

        colors = self.cmap(np.repeat(.5, len(triangles)))
        colors = array_to_plotly(colors)
        self.surfacedata = ff._trisurf(
            x=self.x, y=self.y, z=self.z, simplices=self.triangles,
            color_func=colors, **kwargs)
        self.surfacedata[0]['lighting'] = lighting
        self.facecolors = self.surfacedata[0]['facecolor'].copy()
        self.tri_centroids = xyz[triangles].mean(1)
        self.layout['scene'].update(dict(xaxis=dict(range=self.xrange),
                                         yaxis=dict(range=self.yrange),
                                         zaxis=dict(range=self.zrange)))
开发者ID:monfera,项目名称:ecogtools,代码行数:35,代码来源:viz3d.py

示例2: init_graph

# 需要导入模块: from plotly.tools import FigureFactory [as 别名]
# 或者: from plotly.tools.FigureFactory import _trisurf [as 别名]
 def init_graph(self, plot_args, plot_kwargs):
     if hasattr(FF, '_trisurf'):
         trisurf = FF._trisurf(*plot_args[:-1], **plot_kwargs)
     else:
         trisurf = trisurface(*plot_args, **plot_kwargs)
     return trisurf[0]
开发者ID:mforbes,项目名称:holoviews,代码行数:8,代码来源:chart3d.py


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