pyvista.Renderer.remove_actor#

Renderer.remove_actor(actor, reset_camera=False, render=True)[source]#

Remove an actor from the Renderer.

Parameters:
actorstr, vtk.vtkActor, list or tuple

If the type is str, removes the previously added actor with the given name. If the type is vtk.vtkActor, removes the actor if it’s previously added to the Renderer. If list or tuple, 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.

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()
../../../_images/pyvista-Renderer-remove_actor-1_00_00.png