pyvista.Renderer.add_axes#

Renderer.add_axes(interactive=None, line_width=2, color=None, x_color=None, y_color=None, z_color=None, xlabel='X', ylabel='Y', zlabel='Z', labels_off=False, box=None, box_args=None, viewport=(0, 0, 0.2, 0.2), **kwargs)[source]#

Add an interactive axes widget in the bottom left corner.

Parameters:
interactivebool, optional

Enable this orientation widget to be moved by the user.

line_widthint, default: 2

The width of the marker lines.

colorColorLike, optional

Color of the labels.

x_colorColorLike, optional

Color used for the x axis arrow. Defaults to theme axes parameters.

y_colorColorLike, optional

Color used for the y axis arrow. Defaults to theme axes parameters.

z_colorColorLike, optional

Color used for the z axis arrow. Defaults to theme axes parameters.

xlabelstr, default: “X”

Text used for the x axis.

ylabelstr, default: “Y”

Text used for the y axis.

zlabelstr, default: “Z”

Text used for the z axis.

labels_offbool, default: false

Enable or disable the text labels for the axes.

boxbool, optional

Show a box orientation marker. Use box_args to adjust. See pyvista.create_axes_orientation_box() for details.

box_argsdict, optional

Parameters for the orientation box widget when box=True. See the parameters of pyvista.create_axes_orientation_box().

viewportsequence[float], default: (0, 0, 0.2, 0.2)

Viewport (xstart, ystart, xend, yend) of the widget.

**kwargsdict, optional

Used for passing parameters for the orientation marker widget. See the parameters of pyvista.create_axes_marker().

Returns:
vtk.vtkAxesActor

Axes actor.

Examples

Show axes without labels and with thick lines.

>>> import pyvista as pv
>>> pl = pv.Plotter()
>>> actor = pl.add_mesh(pv.Box(), show_edges=True)
>>> _ = pl.add_axes(line_width=5, labels_off=True)
>>> pl.show()
../../../_images/pyvista-Renderer-add_axes-1_00_00.png

Use the axes orientation widget instead of the default arrows.

>>> pl = pv.Plotter()
>>> actor = pl.add_mesh(pv.Sphere())
>>> _ = pl.add_axes(box=True)
>>> pl.show()
../../../_images/pyvista-Renderer-add_axes-1_01_00.png

Specify more parameters for the axes marker.

>>> import pyvista as pv
>>> pl = pv.Plotter()
>>> actor = pl.add_mesh(pv.Box(), show_edges=True)
>>> _ = pl.add_axes(
...     line_width=5,
...     cone_radius=0.6,
...     shaft_length=0.7,
...     tip_length=0.3,
...     ambient=0.5,
...     label_size=(0.4, 0.16),
... )
>>> pl.show()
../../../_images/pyvista-Renderer-add_axes-1_02_00.png