注釈
Go to the end をクリックすると完全なサンプルコードをダウンロードできます.
メッシュまたはプロット全体の消去#
この例では,シーンから要素を削除する方法を示します.
from __future__ import annotations
import pyvista as pv
plotter = pv.Plotter()
actor = plotter.add_mesh(pv.Sphere())
plotter.remove_actor(actor)
plotter.show()

プロットウィンドウ全体をクリアする:
plotter = pv.Plotter()
plotter.add_mesh(pv.Sphere())
plotter.add_mesh(pv.Plane())
plotter.clear() # clears all actors
plotter.show()

または,追加するときに任意のアクターに name
を指定し,アクターが後で同じ名前で追加された場合に,前のアクターを置き換えます:
plotter = pv.Plotter()
plotter.add_mesh(pv.Sphere(), name='mymesh')
plotter.add_mesh(pv.Plane(), name='mymesh')
# Only the Plane is shown.
plotter.show()

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