pyvista.Label#

class Label(
text: str | None = None,
position: VectorLike[float] = (0.0, 0.0, 0.0),
*,
size: int = 50,
prop: pyvista.Property | None = None,
)[source]#

2D label actor with a 3D position coordinate.

Parameters:
textstr, optional

Text string to be displayed.

positionVectorLike[float]

The position coordinate.

sizeint

Size of the text label.

proppyvista.TextProperty, optional

The property of this actor.

Examples

Create a label for a point of interest.

>>> import pyvista as pv
>>> mesh = pv.Cone()
>>> tip_point = mesh.points[0]
>>> label = pv.Label('tip', position=tip_point)

Plot the mesh and label.

>>> pl = pv.Plotter()
>>> _ = pl.add_mesh(mesh)
>>> _ = pl.add_actor(label)
>>> pl.show()
../../../_images/pyvista-Label-1_00_00.png

Methods

Attributes

Label.position

Text position coordinate in xyz space.

Label.size

Size of the text label.