add_labels#

PrimePlotter.add_labels(points, labels, font_size=12, point_size=5.0, **kwargs)#

Add labels at 3D point locations.

This method provides a backend-agnostic way to add text labels at specific 3D coordinates in the visualization scene. Labels are displayed next to marker points.

Parameters:
pointsUnion[List, Any]

Points where labels should be placed. Can be a list of coordinates or array-like object. Expected format: [[x1, y1, z1], …] or Nx3 array.

labelsList[str]

List of label strings to display at each point. Must have the same length as points.

font_sizeint, default: 12

Font size for the labels.

point_sizefloat, default: 5.0

Size of the point markers shown with labels.

**kwargsdict

Additional backend-specific keyword arguments for advanced customization (e.g., text_color, shape, fill_shape).

Returns:
:
Any

Backend-specific actor or object representing the added labels. Can be used for further manipulation or removal.

Return type:

Any

Examples

Add labels at specific locations:

>>> from ansys.tools.visualization_interface import Plotter
>>> plotter = Plotter()
>>> points = [[0, 0, 0], [1, 0, 0], [0, 1, 0]]
>>> labels = ['Origin', 'X-axis', 'Y-axis']
>>> plotter.add_labels(points, labels, font_size=14)
>>> plotter.show()

Add labels with custom styling:

>>> plotter.add_labels(
...     points,
...     labels,
...     font_size=16,
...     point_size=10,
...     text_color='yellow',
...     shape='rounded_rect'
... )
>>> plotter.show()