Actor#

class Actor(*args, **kwargs)[source]#

Wrap vtkActor.

This class represents the geometry & properties in a rendered scene. Normally, a pyvista.Actor is constructed from pyvista.Plotter.add_mesh(), but there may be times when it is more convenient to construct an actor directly from a pyvista.DataSetMapper.

Parameters:
mapperpyvista.DataSetMapper, optional

DataSetMapper.

proppyvista.Property, optional

Property of the actor.

namestr, optional

The name of this actor used when tracking on a plotter.

Examples#

Download Python source code | Download Jupyter notebook

Create an actor without using pyvista.Plotter.

>>> import pyvista as pv
>>> mesh = pv.Sphere()
>>> mapper = pv.DataSetMapper(mesh)
>>> actor = pv.Actor(mapper=mapper)
>>> actor
Actor (...)
  Center:                     (0.0, 0.0, 0.0)
  Pickable:                   True
  Position:                   (0.0, 0.0, 0.0)
  Scale:                      (1.0, 1.0, 1.0)
  Visible:                    True
  X Bounds                    -4.993E-01, 4.993E-01
  Y Bounds                    -4.965E-01, 4.965E-01
  Z Bounds                    -5.000E-01, 5.000E-01
  User matrix:                Identity
  Has mapper:                 True
...

Change the actor properties and plot the actor.

>>> import pyvista as pv
>>> mesh = pv.Sphere()
>>> mapper = pv.DataSetMapper(mesh)
>>> actor = pv.Actor(mapper=mapper)
>>> actor.prop.color = 'blue'
>>> actor.plot()
../../../_images/pyvista-Actor-a599d0c27e371ef1_00_00.png

Create an actor using the pyvista.Plotter and then change the visibility of the actor.

>>> import pyvista as pv
>>> pl = pv.Plotter()
>>> mesh = pv.Sphere()
>>> actor = pl.add_mesh(mesh)
>>> actor.visibility = False
>>> actor.visibility
False

Inheritance#

Inherited members are documented on Prop3D, _NameMixin, _BoundsSizeMixin.

See them all under Inherited Attributes and Inherited Methods.

Wraps vtkActor.

Attributes#

Actor.backface_prop

Return or set the backface property.

Actor.force_opaque

Return or set actor opacity behavior.

Actor.mapper

Return or set the mapper of the actor.

Actor.memory_address

Return the memory address of this actor.

Actor.pickable

Return or set actor pickability.

Actor.prop

Return or set the property of this actor.

Actor.texture

Return or set the actor texture.

Actor.use_bounds

Return or set the use of actor's bounds.

Actor.visibility

Return or set actor visibility.

Inherited Attributes#

Prop3D.bounds

Return the bounds of the entity.

_BoundsSizeMixin.bounds_size

Return the size of each axis of the object’s bounding box.

Prop3D.center

Return the center of the entity.

Prop3D.length

Return the length of the entity.

_NameMixin.name

Get or set the unique name identifier used by PyVista.

Prop3D.orientation

Return or set the entity orientation angles.

Prop3D.origin

Return or set the entity origin.

Prop3D.position

Return or set the entity position.

Prop3D.scale

Return or set entity scale.

Prop3D.user_matrix

Return or set the user matrix.

Methods#

Actor.add_shader_replacement(shader_type, ...)

Add a GLSL shader replacement to this actor.

Actor.clear_point_sprite_shape()

Clear the custom point sprite shape.

Actor.clear_shader_replacements(*[, ...])

Clear shader replacements from this actor.

Actor.copy([deep])

Create a copy of this actor.

Actor.disable_maximum_intensity_projection()

Disable maximum intensity projection.

Actor.enable_maximum_intensity_projection([clim])

Enable maximum intensity projection.

Actor.plot(**kwargs)

Plot just the actor.

Actor.set_point_sprite_shape(shape)

Set a custom point sprite shape via fragment shader.

Inherited Methods#

Prop3D.rotate_x

Rotate the entity about the x-axis.

Prop3D.rotate_y

Rotate the entity about the y-axis.

Prop3D.rotate_z

Rotate the entity about the z-axis.

Prop3D.rotation_from

Set the entity’s orientation from a rotation.

Prop3D.transform

Apply a transformation to this object’s user_matrix.