add_axes#

Plotter.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), marker_args=None, **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, optional

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, optional

Text used for the x axis.

ylabelstr, optional

Text used for the y axis.

zlabelstr, optional

Text used for the z axis.

labels_offbool, optional

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().

viewporttuple, optional

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

marker_argsdict, optional

Marker arguments.

Deprecated since version 0.37.0: Use **kwargs for passing parameters for the orientation marker widget. See the parameters of pyvista.create_axes_marker().

**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
>>> pl = pyvista.Plotter()
>>> actor = pl.add_mesh(pyvista.Box(), show_edges=True)
>>> _ = pl.add_axes(line_width=5, labels_off=True)
>>> pl.show()
../../../_images/pyvista-Plotter-add_axes-1_00_00.png

Use the axes orientation widget instead of the default arrows.

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

Specify more parameters for the axes marker.

>>> import pyvista
>>> pl = pyvista.Plotter()
>>> actor = pl.add_mesh(pyvista.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-Plotter-add_axes-1_02_00.png