pyvista.AxesAssembly.user_matrix#

property AxesAssembly.user_matrix: NumpyArray[float][source]#

Return or set the user matrix.

In addition to the instance variables such as position and orientation, the user can add a transformation to the actor.

This matrix is concatenated with the actor’s internal transformation that is implicitly created when the actor is created. The user matrix is the last transformation applied to the actor before rendering.

Returns:
np.ndarray

A 4x4 transformation matrix.

Examples

Apply a 4x4 transformation to the axes. This effectively translates the actor by one unit in the Z direction, rotates the actor about the z-axis by approximately 45 degrees, and shrinks the actor by a factor of 0.5.

>>> import numpy as np
>>> import pyvista as pv
>>> axes = pv.AxesAssembly()
>>> array = np.array(
...     [
...         [0.35355339, -0.35355339, 0.0, 0.0],
...         [0.35355339, 0.35355339, 0.0, 0.0],
...         [0.0, 0.0, 0.5, 1.0],
...         [0.0, 0.0, 0.0, 1.0],
...     ]
... )
>>> axes.user_matrix = array
>>> pl = pv.Plotter()
>>> _ = pl.add_actor(axes)
>>> pl.show()
../../../_images/pyvista-AxesAssembly-user_matrix-1_00_00.png