Clearing a Mesh or the Entire Plot

Clearing a Mesh or the Entire Plot#

This example demonstrates how to remove elements from a scene.

from __future__ import annotations

import pyvista as pv
clear

Clearing the entire plotting window:

clear

Or you can give any actor a name when adding it and if an actor is added with that same name at a later time, it will replace the previous actor:

plotter = pv.Plotter()
plotter.add_mesh(pv.Sphere(), name='mymesh')
plotter.add_mesh(pv.Plane(), name='mymesh')
# Only the Plane is shown.
plotter.show()
clear

Tags: plot

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

Gallery generated by Sphinx-Gallery