注釈
Go to the end to download the full example code.
ゴーストを使用してセルを非表示にする#
印刷時に非表示にする特定のセルを指定します.
これは,新しいメッシュを作成せずにメッシュ内のセルをすばやく非表示にするための,閾値の代わりとなる軽量のオプションです.
特に,これが機能するためにはメッシュを pyvista.UnstructuredGrid
型にキャストする必要があります( cast_to_unstructured_grid
フィルターを使用する).
from __future__ import annotations
import numpy as np
from pyvista import examples
vol = examples.load_channels()
mesh = vol.cast_to_unstructured_grid()
基準を使用してゴースト化するセルを決定します(この配列を自由に調整するか,手動で作成して特定のセルを非表示にします).
ghosts = np.argwhere(mesh['facies'] < 1.0)
# This will act on the mesh inplace to mark those cell indices as ghosts
mesh.remove_cells(ghosts, inplace=True)
メッシュをプロットすると,これらのセルは非表示になります.
mesh.plot(clim=[0, 4])

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