注釈
Go to the end をクリックすると完全なサンプルコードをダウンロードできます.
スクリーンショットを保存する#
from __future__ import annotations
import matplotlib.pyplot as plt
import pyvista as pv
from pyvista import examples
# Get a sample file
filename = examples.planefile
mesh = pv.read(filename)
pyvista.Plotter
を使用して,インタラクティブなプロットウィンドウを作成せずにスクリーンショットを撮ることもできます.
plotter = pv.Plotter(off_screen=True)
plotter.add_mesh(mesh, color='orange')
plotter.show(screenshot='airplane.png')

img
配列を使用して,スクリーンショットを matplotlib
にプロットすることができます.
plt.imshow(plotter.image)
plt.show()

Total running time of the script: (0 minutes 0.353 seconds)