Points2D

A 2D point cloud with positions and optional colors, radii, labels, etc.

Components components

Required: Position2D

Recommended: Radius, Color

Optional: Text, DrawOrder, ClassId, KeypointId

Shown in shown-in

Examples examples

Simple 2D points simple-2d-points

"""Log some very simple points."""

import rerun as rr
import rerun.blueprint as rrb

rr.init("rerun_example_points2d", spawn=True)

rr.log("points", rr.Points2D([[0, 0], [1, 1]]))

# Set view bounds:
rr.send_blueprint(rrb.Spatial2DView(visual_bounds=rrb.VisualBounds2D(x_range=[-1, 2], y_range=[-1, 2])))

Randomly distributed 2D points with varying color and radius randomly-distributed-2d-points-with-varying-color-and-radius

"""Log some random points with color and radii."""

import rerun as rr
import rerun.blueprint as rrb
from numpy.random import default_rng

rr.init("rerun_example_points2d_random", spawn=True)
rng = default_rng(12345)

positions = rng.uniform(-3, 3, size=[10, 2])
colors = rng.uniform(0, 255, size=[10, 4])
radii = rng.uniform(0, 1, size=[10])

rr.log("random", rr.Points2D(positions, colors=colors, radii=radii))

# Set view bounds:
rr.send_blueprint(rrb.Spatial2DView(visual_bounds=rrb.VisualBounds2D(x_range=[-4, 4], y_range=[-4, 4])))

Log points with radii given in UI points log-points-with-radii-given-in-ui-points

"""Log some points with ui points & scene unit radii."""

import rerun as rr
import rerun.blueprint as rrb

rr.init("rerun_example_points2d_ui_radius", spawn=True)

# Two blue points with scene unit radii of 0.1 and 0.3.
rr.log(
    "scene_units",
    rr.Points2D(
        [[0, 0], [0, 1]],
        # By default, radii are interpreted as world-space units.
        radii=[0.1, 0.3],
        colors=[0, 0, 255],
    ),
)

# Two red points with ui point radii of 40 and 60.
# UI points are independent of zooming in Views, but are sensitive to the application UI scaling.
# For 100% ui scaling, UI points are equal to pixels.
rr.log(
    "ui_points",
    rr.Points2D(
        [[1, 0], [1, 1]],
        # rr.Radius.ui_points produces radii that the viewer interprets as given in ui points.
        radii=rr.Radius.ui_points([40.0, 60.0]),
        colors=[255, 0, 0],
    ),
)

# Set view bounds:
rr.send_blueprint(rrb.Spatial2DView(visual_bounds=rrb.VisualBounds2D(x_range=[-1, 2], y_range=[-1, 2])))