PyVista 3D数据可视化 Python 库 简介

Pyvista是一个用于科学可视化和分析的Python库 ;我认为它适合做一些网格数据的处理;
它封装了VTK(Visualization Toolkit)之上,提供了一些高级接口, 3D数据可视化变得更加简单和易用。

1.安装 pyvista:

使用以下命令安装 pyvista:

pip install pyvista

2.使用:

pyvista: 导入 pyvista 库来开始使用它:

import pyvista as pv

3.样例:

画一个3D 小球

import pyvista as pv

sphere = pv.Sphere()


pl = pv.Plotter()
pl.add_mesh(sphere, style='wireframe', color='k', line_width=2)
 
pl.show()

 4.  普通几何对象 Geometric Objects

import pyvista as pv

 

cyl = 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, color='lightblue', show_edges=True)
p.subplot(0, 1)
p.add_mesh(arrow, color='lightblue', show_edges=True)
p.subplot(0, 2)
p.add_mesh(sphere, color='lightblue', show_edges=True)
# Middle row
p.subplot(1, 0)
p.add_mesh(plane, color='lightblue', show_edges=True)
p.subplot(1, 1)
p.add_mesh(line, color='lightblue', line_width=3)
p.subplot(1, 2)
p.add_mesh(box, color='lightblue', show_edges=True)
# Bottom row
p.subplot(2, 0)
p.add_mesh(cone, color='lightblue', show_edges=True)
p.subplot(2, 1)
p.add_mesh(poly, color='lightblue', show_edges=True)
p.subplot(2, 2)
p.add_mesh(disc, color='lightblue', show_edges=True)
# Render all of them
p.show()

相关推荐

  1. 3D 数据

    2024-04-29 06:16:02       34 阅读
  2. KITTI 3D 数据

    2024-04-29 06:16:02       37 阅读
  3. 深入浅出(四)VTK3D

    2024-04-29 06:16:02       40 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-04-29 06:16:02       94 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-04-29 06:16:02       101 阅读
  3. 在Django里面运行非项目文件

    2024-04-29 06:16:02       82 阅读
  4. Python语言-面向对象

    2024-04-29 06:16:02       91 阅读

热门阅读

  1. 高频SQL 查找拥有有效邮箱的用户

    2024-04-29 06:16:02       28 阅读
  2. 拿来即用的响应式布局方法

    2024-04-29 06:16:02       32 阅读
  3. 从 sqlite 迁移到 Oracle 数据库

    2024-04-29 06:16:02       33 阅读
  4. Hive 单机版

    2024-04-29 06:16:02       28 阅读
  5. C++作业

    C++作业

    2024-04-29 06:16:02      25 阅读
  6. vue 跳转页面打开浏览器新窗口或者打开新标签

    2024-04-29 06:16:02       29 阅读
  7. 【Spring】1.Spring中IOC与DI全解析

    2024-04-29 06:16:02       29 阅读
  8. 将pdf转化为图片的方法

    2024-04-29 06:16:02       28 阅读
  9. golang封装调用kafka的工具包

    2024-04-29 06:16:02       26 阅读