---
title: Plot Transform Functions
sidebar:
  order: 35
---
In the Roboto Visualizer, the **Y Transform** field in the plot series settings lets you apply a mathematical formula to transform the Y values of a series. This is useful for unit conversion, normalization, scaling, smoothing noisy signals, taking derivatives, and other on-the-fly calculations.

The formula is written as an expression in terms of the variable `y`, the raw signal value at each point in time — for example `y / 9.81` or `sqrt(y)`. Some functions, such as `savgol` and `deriv`, are **windowed**: they read a buffered run of samples rather than a single point. Operators and functions nest freely, so transforms compose; see the **Examples** section below.

## Supported operators

| Operator | Description |
| --- | --- |
| `+` | Addition |
| `-` | Subtraction |
| `*` | Multiplication |
| `/` | Division |
| `%` | Modulo (remainder) |
| `^` | Exponentiation (e.g. `y^2` squares the value) |

## Supported functions

| Function | Description |
| --- | --- |
| `abs(y)` | Absolute value |
| `sqrt(y)` | Square root |
| `pow(base, exponent)` | Raise `base` to `exponent` (both arguments are expressions; e.g. `pow(y, 2)` squares the value) |
| `sin(y)` | Sine (argument in radians) |
| `cos(y)` | Cosine (argument in radians) |
| `tan(y)` | Tangent (argument in radians) |
| `log(y)` | Natural logarithm (base *e*) |
| `exp(y)` | Exponential (*e* raised to the power `y`) |
| `min(a, b)` | Smaller of two values |
| `max(a, b)` | Larger of two values |
| `round(y)` | Round to the nearest integer |
| `floor(y)` | Round down to the nearest integer |
| `ceil(y)` | Round up to the nearest integer |
| `rad(y)` | Convert degrees to radians (multiply by π/180) |
| `deg(y)` | Convert radians to degrees (multiply by 180/π) |
| `savgol(y, window, order)` | Savitzky–Golay smoothing. `window` is the window length **in seconds**; `order` is the polynomial order (typically 2 or 3). |
| `deriv(y, n)` | Central-difference derivative. `n` is the derivative order — 1 (first) or 2 (second). Defaults to 1 when omitted, so `deriv(y)` is shorthand for `deriv(y, 1)`. |

## Supported constants

| Constant | Value |
| --- | --- |
| `PI` | π ≈ 3.14159265358979 |
| `E` | *e* ≈ 2.71828182845905 |

## Examples

Quick reference of common transforms (every operator, function, and constant used here is documented in the sections above):

| Formula | Effect |
| --- | --- |
| `y / 9.81` | Convert m/s² to g-force |
| `y * 3.28084` | Convert metres to feet |
| `2.5 * y + 10` | Linear scale-and-offset (template: replace `2.5` and `10` with your slope and intercept) |
| `round(y * 100) / 100` | Round to two decimal places |
| `savgol(y, 0.5, 3)` | Savitzky–Golay smoothing with a 0.5-second window, polynomial order 3 |
| `savgol(y / 9.81, 0.5, 3)` | Convert m/s² to g-force *and* smooth |
| `deriv(y, 1)` | First derivative (raw central difference) |
| `deriv(savgol(y, 0.5, 3), 1)` | Smoothed first derivative — derivative of an SG-smoothed signal |
| `log(savgol(y, 0.5, 3))` | Functions nest freely — here, the natural log of a smoothed signal |

## Usage notes

- The variable `y` is the only supported input variable. It represents the raw signal value at a given timestamp.
- Functions and constants are case-sensitive: use `sqrt` not `Sqrt`, and `PI` not `pi`.
- For `savgol`, the second and third arguments (`window` and `order`) must be constant numbers; for `deriv`, the second argument (`n`) must be a constant number when present. None of these may reference `y` or any other variable.
- A derivative changes the y-axis units (position in metres becomes m/s after one differentiation, m/s² after two). Use the **Label** field on the series if you want the displayed name to reflect the new units.
- **Performance and memory.** A formula containing `savgol` or `deriv` buffers the full underlying message stream and skips the visualization-only downsampling step so the kernel sees contiguous samples. On multi-million-sample topics this can use substantially more memory and take longer to render than a point-wise formula.

## When to use a derived topic instead [#derived-topics-via-actions]

The Y Transform field is designed for single-series expressions. If your use case requires something more complex — combining multiple signals, applying stateful filters across sessions, resampling to a uniform grid, or computing rolling statistics — consider creating a **derived topic** as part of your ingestion pipeline using a Roboto Action.

An Action runs on hosted compute after a file is ingested and can write new topics back to Roboto using the Python SDK. Those derived topics then appear alongside the original signals in the visualizer and can be plotted directly, without any runtime transform.

See [Process Data with Actions](/docs/user-guides/process-data-actions) and [Create Your Own Action](/docs/user-guides/process-data-actions/creating-your-own-action) for a full walkthrough, and the [Python SDK](/docs/reference/python-sdk) reference for the topic-writing APIs.
