esc
Start typing to search the docs
Navigate Open

Show text labels in 2D and 3D

Add labels

Many 2D and 3D archetypes have a labels field: Points2D, Points3D, Boxes2D, Boxes3D, Arrows2D, Arrows3D, LineStrips2D, LineStrips3D, Ellipses2D, Ellipsoids3D, Capsules3D, Cylinders3D, and GraphNodes.

rr.log(
    "detections",
    rr.Boxes2D(
        mins=[[10, 10], [80, 40]],
        sizes=[[50, 30], [40, 40]],
        labels=["car", "person"],
    ),
)
  • With one label per instance, each instance gets its own label.
  • With a single label, it is placed once, at the center of the entity.

Labels can also come from an annotation context, through class IDs.

Why are my labels not shown?

By default, labels are only shown when the entity has a single label, or when it has few instances. This keeps large point clouds readable. To always show them, set show_labels=True:

rr.log("points", rr.Points3D(positions, labels=names, show_labels=True))

You can also toggle show_labels in the Viewer: select the entity and change it in the visualizer section of the selection panel.

A standalone text label

There is no archetype for text alone. To place a label at a position in 2D or 3D, log a single point with a label, and make the point small:

rr.log("world/label", rr.Points3D([[1.0, 2.0, 0.5]], labels="Start", radii=0.001))

Limitations

Labels are drawn at a fixed screen size. You cannot change the font size or the font, and labels do not scale with the zoom level. See missing features.