pyvista.Renderer.remove_actor#
- Renderer.remove_actor(actor, reset_camera=False, render=True)[source]#
Remove an actor from the Renderer.
- Parameters:
- actor
str| vtkActor |list|tuple If the type is
str, removes the previously added actor with the given name. If the type is vtkActor, removes the actor if it’s previously added to the Renderer. Iflistortuple, removes iteratively each actor.- reset_camerabool,
optional Resets camera so all actors can be seen.
- renderbool,
optional Render upon actor removal. Set this to
Falseto stop the render window from rendering when an actor is removed.
- actor
- Returns:
- bool
Truewhen actor removed.Falsewhen actor has not been removed.
Examples
Add two meshes to a plotter and then remove the sphere actor.
>>> import pyvista as pv >>> mesh = pv.Cube() >>> pl = pv.Plotter() >>> cube_actor = pl.add_mesh(pv.Cube(), show_edges=True) >>> sphere_actor = pl.add_mesh(pv.Sphere(), show_edges=True) >>> _ = pl.remove_actor(cube_actor) >>> pl.show()