---
title: Plot any scalar
order: 600
---
Rerun can plot numerical data as a time series, even data that wasn't logged with Rerun semantics.
By remapping where a visualizer reads its inputs from, you can separate how you _model_ your data from how you _visualize_ it.
This is useful for plotting custom messages from MCAPs, or data logged via `AnyValues` and `DynamicArchetype`.
As a bonus, logging multiple scalars to the same entity can drastically reduce `.rrd` file sizes.
Each visualizer takes components as input and determines their values from various sources.
By configuring _component mappings_, you can control exactly where each input comes from.
The supported data types are:
- `Float32` and `Float64`
- `Int8`, `Int16`, `Int32`, and `Int64`
- `UInt8`, `UInt16`, `UInt32`, and `UInt64`
- `Boolean`
- Any of the above nested inside of [Arrow structs](https://arrow.apache.org/docs/format/Intro.html#struct).
For background on how visualizers resolve component values, see [Customize views](../../concepts/visualization/customize-views.md).
## Logging custom data
Use `DynamicArchetype` to send data with custom component names alongside regular Rerun data.
Flat arrays and Arrow `StructArray`s are both supported.
This is what the data looks like for the `/plot` entity:
snippet: howto/component_mapping[custom_data]
## Remapping components
A visualizer can source its inputs from any component with a compatible datatype.
For example, the `SeriesLines` visualizer accepts any numerical data for its `Scalar` input.
This works with data from MCAP files, `AnyValues`, or `DynamicArchetype`.
Optional components like `Names` and `Colors` can be sourced similarly from arbitrary data.
The following remaps the `Scalars:scalars` input to read from `custom:my_custom_scalar` instead:
snippet: howto/component_mapping[source_mapping]
### Add data by dragging components
You can set up this mapping interactively instead of via the blueprint API: drag a component from the streams tree onto a time series view. If the component has a compatible (numeric) datatype, a new `SeriesLines` visualizer is added that remaps `Scalars:scalars` from it. Non-numeric components (e.g. a string) are rejected, as is dropping a component that the view already plots.
## Selectors for nested data
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`:
snippet: howto/component_mapping[nested_struct]
The following remaps the `Scalars:scalars` input to read from `custom:my_nested_scalar` and selects the `values` field:
snippet: howto/component_mapping[selector_mapping]
## Providing default values
You can also force a visualizer to use a specific source kind. Setting the source to `Default` makes the visualizer
ignore any store data and use the view's default instead:
snippet: howto/component_mapping[custom_value]
## Full example
The complete example logs three series to a single entity and configures each with a different component mapping strategy. This leads to the following visualizers for the `/plot` entity:
* 🐍 [Python](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/howto/component_mapping.py)
* 🦀 [Rust](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/howto/component_mapping.rs)
When the view is selected, the selection panel shows an overview of all configured visualizers: