概要#
PyVistaは:
Pythonic VTK: Visualization Toolkit (VTK) の高レベルAPI
空間データセットのメッシュデータ構造とフィルタリング方法
大規模/複雑なデータジオメトリ用にシンプルかつ構築された3 Dプロット
PyVistaはVisualization Toolkit (VTK) 用のヘルパーライブラリで,NumPyと配列への直接アクセスを介してVTKとのインターフェースを取るための,異なるアプローチをとっています.このパッケージは,VTKの強力な可視化バックエンドを公開するPythonの十分に文書化されたインターフェースを提供し,空間的に参照されたデータセットの迅速なプロトタイピング,分析,および視覚的統合を容易にします.
このモジュールは,他のメッシュ依存Pythonモジュールのサポートモジュールと同様に,プレゼンテーションや研究論文の科学的プロットにも使用できます.
PyVistaを試してみたいですか?MyBinderのライブサンプルをチェックしてみてください:
簡単な例#
以下に,PyVistaの使用方法を示す簡単な対話型の例をいくつか示します.
マップと地球科学#
St.Helens山の標高マップをダウンロードしてプロットします.
from pyvista import examples
mesh = examples.download_st_helens()
warped = mesh.warp_by_scalar('Elevation')
surf = warped.extract_surface().triangulate()
surf = surf.decimate_pro(0.75) # reduce the density of the mesh by 75%
surf.plot(cmap='gist_earth')
有限要素解析#
3 D切欠き試験片の弾性応力の 'X' 成分をプロットします.
from pyvista import examples
mesh = examples.download_notch_stress()
mesh.plot(scalars='Nodal Stress', component=0, cmap='turbo', cpos='xy')
NumPyを使用した単純なポイントクラウド#
NumPyと簡単に統合し,さまざまなジオメトリを作成してプロットできます.任意のジオメトリを使用して字形を作成したり,点を直接プロットすることもできます.
import numpy as np
import pyvista as pv
rng = np.random.default_rng(seed=0)
point_cloud = rng.random((100, 3))
pdata = pv.PolyData(point_cloud)
pdata['orig_sphere'] = np.arange(100)
# create many spheres from the point cloud
sphere = pv.Sphere(radius=0.02, phi_resolution=10, theta_resolution=10)
pc = pdata.glyph(scale=False, geom=sphere, orient=False)
pc.plot(cmap='Reds')
スプラインをプロットする#
NumPyの点の配列からスプラインを生成します.
import numpy as np
import pyvista as pv
# Make the xyz points
theta = np.linspace(-10 * np.pi, 10 * np.pi, 100)
z = np.linspace(-2, 2, 100)
r = z**2 + 1
x = r * np.sin(theta)
y = r * np.cos(theta)
points = np.column_stack((x, y, z))
spline = pv.Spline(points, 500).tube(radius=0.1)
spline.plot(scalars='arc_length', show_scalar_bar=False)
メッシュ上のブール演算#
立方体メッシュから球体を減算します.
import pyvista as pv
import numpy as np
def make_cube():
x = np.linspace(-0.5, 0.5, 25)
grid = pv.StructuredGrid(*np.meshgrid(x, x, x))
surf = grid.extract_surface().triangulate().flip_faces()
return surf
# Create example PolyData meshes for boolean operations
sphere = pv.Sphere(radius=0.65, center=(0, 0, 0))
cube = make_cube()
# Perform a boolean difference
boolean = cube.boolean_difference(sphere)
boolean.plot(color='darkgrey', smooth_shading=True, split_sharp_edges=True)
体積データのプロット#
水素原子の \(3d_{xy}\) 軌道をプロットしてください.
注釈
この例では, sympy が必要です.
from pyvista import examples
grid = examples.load_hydrogen_orbital(3, 2, -2)
grid.plot(volume=True, opacity=[1, 0, 1], cmap='magma')
翻訳#
新しいコントリビューターが PyVista の文書を翻訳するために推奨される方法は,Transifexの翻訳チームに参加することです.
pyvista (main) 文書用の pyvista translation page があります.
transifex サービスにログインします.
pyvista translation page に行ってください.
Request languageをクリックし,フォームに入力します.transifex pyvista翻訳メンテナからの承認を待ちます.
(承諾後) transifexで翻訳してください.
atsphinx-mini18n を使用して翻訳文書をホストすることができます。
翻訳は pyvista-doc-translations にバックアップされています.
詳細はこちら: https://help.transifex.com/en/
状態#
プロフェッショナルサポート#
PyVista is a community-driven Open Source project, but many users and organizations rely on it in production workflows, research pipelines, and custom visualization systems. If you need expert guidance, development help, or guaranteed support, there are several ways to engage with the people who build and maintain PyVista.
For general inquiries, reach out to info@pyvista.org and we can help connect you with the right community experts for your 3D visualization or analysis needs.
If you are looking for professional services (consulting, custom development, feature design, integration support, or training), consider sponsoring PyVista's core developers through the “Sponsor this project” section on GitHub. Sponsorship not only provides direct access to experts but also helps sustain critical maintenance and ongoing feature work that keeps PyVista reliable and modern.
More details can be found in the discussion post: pyvista/pyvista#4033
Sponsoring a developer supports both your project and the health of the PyVista ecosystem, ensuring continued improvements, long-term stability, and expert help when you need it.

