免费建站的平台,本地生活网站 源码,支部网站及活动室建设,常州网站建设公司价位Pyvista是一个用于科学可视化和分析的Python库 #xff1b;我认为它适合做一些网格数据的处理#xff1b; 它封装了VTK#xff08;Visualization Toolkit#xff09;之上#xff0c;提供了一些高级接口#xff0c; 3D数据可视化变得更加简单和易用。 1.安装 pyvista…Pyvista是一个用于科学可视化和分析的Python库 我认为它适合做一些网格数据的处理 它封装了VTKVisualization Toolkit之上提供了一些高级接口 3D数据可视化变得更加简单和易用。 1.安装 pyvista
使用以下命令安装 pyvista
pip install pyvista2.使用
pyvista 导入 pyvista 库来开始使用它
import pyvista as pv
3.样例
画一个3D 小球
import pyvista as pvsphere pv.Sphere()pl pv.Plotter()
pl.add_mesh(sphere, stylewireframe, colork, line_width2)pl.show() 4. 普通几何对象 Geometric Objects
import pyvista as pvcyl pv.Cylinder()
arrow pv.Arrow()
sphere pv.Sphere()
plane pv.Plane()
line pv.Line()
box pv.Box()
cone pv.Cone()
poly pv.Polygon()
disc pv.Disc()p pv.Plotter(shape(3, 3))
# Top row
p.subplot(0, 0)
p.add_mesh(cyl, colorlightblue, show_edgesTrue)
p.subplot(0, 1)
p.add_mesh(arrow, colorlightblue, show_edgesTrue)
p.subplot(0, 2)
p.add_mesh(sphere, colorlightblue, show_edgesTrue)
# Middle row
p.subplot(1, 0)
p.add_mesh(plane, colorlightblue, show_edgesTrue)
p.subplot(1, 1)
p.add_mesh(line, colorlightblue, line_width3)
p.subplot(1, 2)
p.add_mesh(box, colorlightblue, show_edgesTrue)
# Bottom row
p.subplot(2, 0)
p.add_mesh(cone, colorlightblue, show_edgesTrue)
p.subplot(2, 1)
p.add_mesh(poly, colorlightblue, show_edgesTrue)
p.subplot(2, 2)
p.add_mesh(disc, colorlightblue, show_edgesTrue)
# Render all of them
p.show()