スクリーンショットを保存する

スクリーンショットを保存する#

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')
screenshot

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

plt.imshow(plotter.image)
plt.show()
screenshot

Tags: plot

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

Sphinx-Galleryによるギャラリー