pyvista.AxesAssembly.set_actor_prop

pyvista.AxesAssembly.set_actor_prop#

AxesAssembly.set_actor_prop(
name: str,
value: float | str | ColorLike | Sequence[float | str | ColorLike],
axis: Literal['x', 'y', 'z', 'all'] = 'all',
part: Literal['shaft', 'tip', 'all'] = 'all',
)[source]#

Set Property attributes for the axes shaft and/or tip actors.

This is a generalized setter method which sets the value of a specific Property attribute for any combination of axis shaft or tip parts.

Parameters:
namestr

Name of the Property attribute to set.

valuefloat | str | ColorLike | Sequence[float | str | ColorLike]

Value to set the attribute to. If a single value, set all specified axes shaft(s) or tip(s) Property attributes to this value. If a sequence of values, set the specified parts to these values.

axisstr | int, default: ‘all’

Set Property attributes for a specific part of the axes. Specify one of:

  • 'x': only set the property for the x-axis.

  • 'y': only set the property for the y-axis.

  • 'z': only set the property for the z-axis.

  • 'all': set the property for all three axes.

partstr | int, default: ‘all’

Set the property for a specific part of the axes. Specify one of:

  • 'shaft': only set the property for the axes shafts.

  • 'tip': only set the property for the axes tips.

  • 'all': set the property for axes shafts and tips.

Examples

Set ambient for all axes shafts and tips to a single value.

>>> import pyvista as pv
>>> axes_assembly = pv.AxesAssembly()
>>> axes_assembly.set_actor_prop('ambient', 0.7)
>>> axes_assembly.get_actor_prop('ambient')
_AxesPropTuple(x_shaft=0.7, y_shaft=0.7, z_shaft=0.7, x_tip=0.7, y_tip=0.7, z_tip=0.7)

Set the property again, but this time set separate values for each part.

>>> values = [0.1, 0.2, 0.3, 0.4, 0.5, 0.6]
>>> axes_assembly.set_actor_prop('ambient', values)
>>> axes_assembly.get_actor_prop('ambient')
_AxesPropTuple(x_shaft=0.1, y_shaft=0.2, z_shaft=0.3, x_tip=0.4, y_tip=0.5, z_tip=0.6)

Set opacity for the x-axis only. The property is set for both the axis shaft and tip by default.

>>> axes_assembly.set_actor_prop('opacity', 0.5, axis='x')
>>> axes_assembly.get_actor_prop('opacity')
_AxesPropTuple(x_shaft=0.5, y_shaft=1.0, z_shaft=1.0, x_tip=0.5, y_tip=1.0, z_tip=1.0)

Set the property again, but this time set separate values for the shaft and tip.

>>> axes_assembly.set_actor_prop('opacity', [0.3, 0.7], axis='x')
>>> axes_assembly.get_actor_prop('opacity')
_AxesPropTuple(x_shaft=0.3, y_shaft=1.0, z_shaft=1.0, x_tip=0.7, y_tip=1.0, z_tip=1.0)

Set show_edges for the axes shafts only. The property is set for all axes by default.

>>> axes_assembly.set_actor_prop('show_edges', True, part='shaft')
>>> axes_assembly.get_actor_prop('show_edges')
_AxesPropTuple(x_shaft=True, y_shaft=True, z_shaft=True, x_tip=False, y_tip=False, z_tip=False)

Set the property again, but this time set separate values for each shaft.

>>> axes_assembly.set_actor_prop(
...     'show_edges', [True, False, True], part='shaft'
... )
>>> axes_assembly.get_actor_prop('show_edges')
_AxesPropTuple(x_shaft=True, y_shaft=False, z_shaft=True, x_tip=False, y_tip=False, z_tip=False)

Set style for a single axis and specific part.

>>> axes_assembly.set_actor_prop(
...     'style', 'wireframe', axis='x', part='shaft'
... )
>>> axes_assembly.get_actor_prop('style')
_AxesPropTuple(x_shaft='Wireframe', y_shaft='Surface', z_shaft='Surface', x_tip='Surface', y_tip='Surface', z_tip='Surface')