pyvista.Renderer.add_north_arrow_widget

pyvista.Renderer.add_north_arrow_widget#

Renderer.add_north_arrow_widget(
interactive=None,
color='#4169E1',
opacity=1.0,
line_width=2,
edge_color=None,
lighting=False,
viewport=(0, 0, 0.1, 0.1),
*,
top_color=None,
bottom_color=None,
)[source]#

Add a geographic north arrow to the scene.

Added in version 0.44.0.

Parameters:
interactivebool, optional

Control if the orientation widget is interactive. By default uses the value from pyvista.global_theme.interactive.

colorColorLike, optional

Color of the north arrow. When top_color or bottom_color is set, this color is applied to the side faces only.

opacityfloat, optional

Opacity of the north arrow.

line_widthfloat, optional

Width of the north edge arrow lines.

edge_colorColorLike, optional

Color of the edges.

lightingbool, optional

Enable or disable lighting on north arrow.

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

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

top_colorColorLike, optional

Color applied to the top face of the arrow. When set (together with or independently from bottom_color), per-face RGB scalars are used so the top face can be distinguished from the bottom at a glance. Defaults to color when only bottom_color is set.

Added in version 0.48.0.

bottom_colorColorLike, optional

Color applied to the bottom face of the arrow. See top_color for details.

Added in version 0.48.0.

Returns:
vtkOrientationMarkerWidget

Orientation marker widget.

See also

add_axes

Add arrow-style axes as an orientation widget.

add_box_axes

Add an axes box as an orientation widget.

add_orientation_widget

Add a custom mesh as an orientation widget.

Axes Objects

Example showing different axes objects.

Examples

Use a north arrow as the orientation widget.

>>> import pyvista as pv
>>> from pyvista import examples
>>> terrain = examples.download_st_helens().warp_by_scalar()
>>> pl = pv.Plotter()
>>> actor = pl.add_mesh(terrain)
>>> widget = pl.add_north_arrow_widget()
>>> pl.enable_terrain_style(mouse_wheel_zooms=True)
>>> pl.show()
../../../_images/pyvista-Renderer-add_north_arrow_widget-3f2ca748e3cbda98_00_00.png

Distinguish the top and bottom of the arrow by coloring the top face a lighter shade and the bottom face a darker shade of the side color.

>>> pl = pv.Plotter()
>>> _ = pl.add_mesh(pv.Sphere())
>>> widget = pl.add_north_arrow_widget(
...     color='royalblue',
...     top_color='lightsteelblue',
...     bottom_color='midnightblue',
... )
>>> pl.show()
../../../_images/pyvista-Renderer-add_north_arrow_widget-3f2ca748e3cbda98_01_00.png