pyvista.Plotter.remove_actor#
- Plotter.remove_actor(actor, reset_camera=False, render=True)[source]#
Remove an actor from the Renderer.
- Parameters:
- actor
str
,vtk.vtkActor
,list
ortuple
If the type is
str
, removes the previously added actor with the given name. If the type isvtk.vtkActor
, removes the actor if it’s previously added to the Renderer. Iflist
ortuple
, removes iteratively each actor.- reset_camerabool,
optional
Resets camera so all actors can be seen.
- renderbool,
optional
Render upon actor removal. Set this to
False
to stop the render window from rendering when an actor is removed.
- actor
- Returns:
- bool
True
when actor removed.False
when 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()