Remap your data

Remapping makes a visualizer read an existing component or nested field that was not logged for that visualizer. The recording blueprint setting is called a component mapping. For example, plot a custom numeric field as a time series without changing the recording. The MCAP importer can expose custom ROS 2 and Protobuf fields using schema reflection.

What remapping is

Visualizers can source their components from other data logged on the same entity, even data with arbitrary semantics.

Within a view, a visualizer can pick up any component that has the same datatype as the builtin type that it expects. For example, the SeriesLines and SeriesPoints visualizers can pick up any numerical data for their Scalar component. The same holds for String-like components that can be selected for Name. Likewise, the state timeline view's visualizer can source its StateChange:state input from any string, boolean, or numeric component (see Visualize state changes).

Such data often comes from MCAP data that has user-defined message types, or from components that were flexibly logged via AnyValues or DynamicArchetype. The Viewer can even look for data with compatible datatypes in nested fields of Arrow StructArrays.

This applies to required components too, not only to optional ones: you can reinterpret a mesh as a point cloud, or graph node positions as plain 2D points. Two kinds of component are excluded. Enum components such as FillMode only accept data that carries the matching Rerun semantics. Image-like visualizers take an arbitrary buffer as their pixel data, but still require a proper ImageFormat alongside it.

Remap in the Viewer

Select an entity in a view, expand the visualizer input in the selection panel, and choose another compatible component in its source menu. You can also drag a compatible component from the streams panel onto a time series or state timeline view to add a visualizer.

Suitable components show up in the source dropdown:

Source dropdown for the scalars of a SeriesLines visualizer, listing JointState joint_positions, velocities, efforts and timestamp fields

For a time series view, drag a compatible numeric component from the streams panel onto the view to add a SeriesLines visualizer. For a state timeline view, drag a compatible string, boolean, or numeric component onto the view to add a lane. Incompatible components and components already visualized are rejected.

Remap from code

Set the visualizer input in a recording blueprint to point to another component:

# Green cosine:
# * source scalars from the custom component
#   "custom:my_custom_scalar"
# * set the name via an override
# * everything else uses the automatic component mappings,
#   so it will pick up colors from the view default.
rr.SeriesLines(names="cosine (custom)").visualizer(
    mappings=[
        # Map scalars to the custom component.
        VisualizerComponentMapping(
            target="Scalars:scalars",
            source_kind=ComponentSourceKind.SourceComponent,
            # Map from custom component
            source_component="custom:my_custom_scalar",
        ),
    ]
),

Example: two point cloud colorings

You can find the full example here:

Two 3D views of the same torus point cloud side by side: Height Colors in a red, white and blue map and Spin Colors in a rainbow map

How the example works

Storing multiple component variants with custom archetypes

A standard archetype like Points3D assigns a fixed column name, as well as component type & archetype metainformation, to every component it logs (Points3D:colors, Points3D:positions, etc.). To store additional variants of a component on the same entity, log them as custom archetypes. The easiest way to do this is to use the DynamicArchetype utility.

# --- Log positions once, then each color set as a separate custom archetype ---
rr.log(
    "pointcloud",
    rr.Points3D(positions, radii=0.06),
    rr.DynamicArchetype(
        "HeightColors",
        components={"colors": rr.components.ColorBatch(height_rgba)},
    ),
    rr.DynamicArchetype(
        "SpinColors", components={"colors": rr.components.ColorBatch(spin_rgba)}
    ),
)

After this call, the entity's component list contains four components:

  • Points3D:positions, Points3D:radii — from the standard archetype
  • HeightColors:colors — the first custom variant
  • SpinColors:colors — the second custom variant

You can inspect this in the viewer by selecting the entity in the streams panel:

Selection panel for the /pointcloud entity listing HeightColors and SpinColors color components next to Points3D positions and radii

Configuring component mappings in blueprint

To make a visualizer read from an arbitrary source, we need to explicitly set the component mapping for a visualizer. The mapping specifies a target (the component the visualizer expects) and a source (the component to actually read from). Everything that isn't explicitly mapped keeps its default behavior.

# --- Blueprint: two side-by-side 3D views with different color mappings ---
blueprint = rrb.Blueprint(
    rrb.Horizontal(
        rrb.Spatial3DView(
            name="Height Colors",
            origin="/",
            overrides={
                "pointcloud": [
                    rr.Points3D.from_fields().visualizer(
                        mappings=[
                            VisualizerComponentMapping(
                                target="Points3D:colors",
                                source_kind=ComponentSourceKind.SourceComponent,
                                source_component="HeightColors:colors",
                            ),
                        ]
                    ),
                ],
            },
        ),
        rrb.Spatial3DView(
            name="Spin Colors",
            origin="/",
            overrides={
                "pointcloud": [
                    rr.Points3D.from_fields().visualizer(
                        mappings=[
                            VisualizerComponentMapping(
                                target="Points3D:colors",
                                source_kind=ComponentSourceKind.SourceComponent,
                                source_component="SpinColors:colors",
                            ),
                        ]
                    ),
                ],
            },
        ),
    ),
    collapse_panels=True,
)

rr.send_blueprint(blueprint)

In this example, each view overrides only the color source for the Points3D visualizer — positions, radii, and everything else are still read from their default sources automatically.

In the viewer you can access this in the visualizer settings, presented when selecting an entity in a view:

Source dropdown for the Points3D colors component, with SpinColors:colors selected over HeightColors:colors, View default and Add custom

Configuring component mappings in the UI

You can set up the same mappings interactively without writing any blueprint code:

  • Add two 3D views (or clone an existing one)
  • Select the entity in one of the views.
  • In the selection panel, find the visualizer section (e.g. Points3D).
  • Click on the component row you want to remap (e.g. colors) to expand the component mapping options.
  • Change the source from the default to the desired custom archetype component (e.g. HeightColors:colors).

Select nested fields

See Selector syntax for the shared selector language.

When your data lives inside an Arrow StructArray, use a selector to extract a specific field. Selectors use a jq-inspired syntax (e.g. .values to select the values field).

Data types are automatically cast when compatible. For example, Float32 data will be cast to Float64 as needed by the visualizer.

Here is how to create a nested StructArray:

def make_sigmoid_struct_array(steps: int) -> pa.StructArray:
    """Creates a StructArray with a `values` field containing sigmoid data.

    Note: We intentionally use float32 here to demonstrate that the data will
    be automatically cast to the correct type (float64) when resolved by the
    visualizer.
    """
    x = np.arange(steps, dtype=np.float32) / 10.0
    sigmoid_values = 1.0 / (1.0 + np.exp(-(x - 3.0)))
    return pa.StructArray.from_arrays(
        [pa.array(sigmoid_values, type=pa.float32())], names=["values"]
    )

The following remaps the Scalars:scalars input to read from custom:my_nested_scalar and selects the values field:

# Blue sigmoid:
# * source scalars from a nested struct using a selector to
#   extract the "values" field
# * set the name and an explicit blue color via overrides
rr.SeriesLines(
    names="sigmoid (nested)", colors=[0, 0, 255]
).visualizer(
    mappings=[
        VisualizerComponentMapping(
            target="Scalars:scalars",
            source_kind=ComponentSourceKind.SourceComponent,
            source_component="custom:my_nested_scalar",
            selector=".values",
        ),
    ]
),

More examples

Lens or remapping?

A component mapping selects an existing component on the same entity, or a nested field, when one visualizer reads data in one view. It is stored in the recording blueprint and does not change the recording. Change the mapping to change that view without affecting other views or queries.

A lens transforms chunks: it can compute values, create component columns, move data to another entity, or create timelines. When used during ingestion, the transformed data can be stored so views and queries see it; lenses can also transform chunks read from existing data. Changing a stored transformation requires processing the data again. Both features use selectors to address fields.

Component mappingLens
WhenWhen a view reads dataWhen chunks are processed
WhereRecording blueprint or ViewerSDK, importer, or chunk stream
EffectChanges what one visualizer readsTransforms data for downstream consumers
ScopeA component on the same entity or a nested fieldCan create or move data across entities and timelines
ComputationSelect a field or cast a compatible typeCompute and transform values

If the value already exists and only one view needs it, remap it. If it needs to be computed or moved, or other consumers need the transformed data, use a lens. For a fixed visual style such as a color, use a visualizer override.