注釈
Go to the end をクリックすると完全なサンプルコードをダウンロードできます.
メッシュまたはプロット全体の消去#
This example demonstrates how to remove elements from a scene using
clear()
.
from __future__ import annotations
import pyvista as pv

プロットウィンドウ全体をクリアする:
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.545 seconds)