Reference for expression syntax and options in the Plot Box (ScottPlot) | Version 1.0
The Plot Box renders 2D scatter/line plots using the ScottPlot library. Data is provided as array expressions that are evaluated against variables defined in Calculator (MathBox) boxes within the workspace.
The Plot Box toolbar contains two main input fields:
| Field | Purpose |
|---|---|
| Expression | One or more Y-axis data expressions (the main input) |
| X-Variable | Optional X-axis data expression (defaults to index 0, 1, 2, …) |
The expression field accepts any value that resolves to a 1-D array of numbers.
| Input | Syntax | Description |
|---|---|---|
| Variable name | A | Uses the array stored in variable A |
| Inline array | [10, 20, 35, 18] | Literal list of values |
| Range | [1..100] | Integer sequence 1, 2, … 100 |
| Range with step | [0..6.28:0.01] | 0.00, 0.01, 0.02, … 6.28 |
| Array expression | A * 2 + 1 | Element-wise arithmetic on array A |
| Function of array | sin(T) | Applies sin to each element of array T |
T = [0..6.28:0.01],
then reference T in the plot expression.
If left empty, the X-axis uses the element index (0, 1, 2, …). Fill in any array expression to provide explicit X values. The X array must have the same number of elements as each Y series.
| Example | Meaning |
|---|---|
T | Use variable T as X values |
[0..6.28:0.01] | Inline range as X values |
A * 0.5 | Computed expression as X values |
Instead of using the separate X-Variable field, you can specify both X and Y data directly in the Expression field using curly-brace notation. This overrides the X-Variable field for the current plot.
{x: x-expression, y: y-expression}
| Example | Description |
|---|---|
{x: T, y: sin(T)} | Plot sin(T) against T |
{x: T, y: [sin(T), cos(T)]} | Two series sharing the same X data |
{x: [1..10], y: A} | Inline X range with variable Y |
Separate multiple Y expressions with a semicolon ; to plot several curves
in the same diagram.
sin(T); cos(T); tan(T)
Each series gets its own color and legend entry automatically.
Assign a custom legend label with the syntax name = expression.
The name must be a valid identifier (letters, digits, underscore).
Temperature = A; Pressure = B
The legend will show "Temperature" and "Pressure" instead of the raw expressions.
==, <=,
>=, !=) are not confused with naming.
Only a bare = preceded by a valid identifier triggers the naming feature.
Wrap multiple expressions in square brackets separated by commas to expand them into individual series. This is a shorthand for semicolon separation.
| Shorthand | Equivalent |
|---|---|
[A, B, C] | A; B; C |
[sin(T), cos(T)] | sin(T); cos(T) |
[1..10] and matrix literals
containing .. or ; are not expanded — they are treated
as single array expressions.
Matrices defined in Calculator boxes can be plotted in several ways.
cols(M)
Each column of matrix M becomes a separate series.
Legend labels are automatically generated as M[,0], M[,1], etc.
rows(M)
Each row of matrix M becomes a separate series.
Legend labels: M[0,], M[1,], etc.
M
When a bare matrix variable name is entered, its columns are automatically
expanded into individual series (same as cols(M)).
Data = cols(M)
Legend labels become Data[0], Data[1], etc.
You can apply any supported math function to an array variable or expression. The function is applied element-wise.
| Expression | Result |
|---|---|
sin(T) | Sine of each element in T |
sqrt(A) | Square root of each element in A |
log(A) | Natural log of each element in A |
abs(A - 5) | Absolute difference from 5 |
A^2 + B^2 | Element-wise combination of two arrays |
The Colors and Widths fields in the toolbar control the
appearance of each series. Values are separated by ; and assigned to series
in order.
#ff0000; #00aa00; blue
Accepts hex codes (#RRGGBB) or named colors.
If fewer colors than series are specified, later series use default colors.
2; 1.5; 3
Numeric values controlling the stroke width of each series line.
The X-Label and Y-Label fields set custom axis titles. If left empty, automatic labels are generated:
| Condition | Auto X-Label | Auto Y-Label |
|---|---|---|
| No X variable | Index | Expression text |
| X variable set | X variable name | Expression text |
| Log scale active | log10(…) | log10(…) |
| Multiple series | (same) | Value |
| Option | Description |
|---|---|
| Degrees / Radians | Switches trigonometric function input mode |
| Show Legend | Toggles the legend panel on/off |
| Legend Position | Moves the legend (e.g. TopRight, BottomLeft, etc.) |
| Show Grid | Toggles background grid lines |
| Show Markers | Toggles data-point markers on each series |
| Log Scale Y | Applies log₁₀ transformation to Y values (values must be > 0) |
| Log Scale X | Applies log₁₀ transformation to X values (values must be > 0) |
In a Calculator box:
T = [0..6.28:0.01]
In the Plot Box expression field:
sin(T)
In the X-Variable field:
T
{x: T, y: [sin(T), cos(T)]}
Expression:
Revenue = A; Cost = B; Profit = A - B
Colors:
#2e7d32; #c62828; #1565c0
Given a 10×3 matrix M defined in a Calculator box:
cols(M)
Plots three series: M[,0], M[,1], M[,2].
Expression:
[1, 10, 100, 1000, 10000]
Enable Log Scale Y in the toolbar. The plot shows values evenly spaced on a log₁₀ axis.
A^2 + 2*A + 1
Plots the polynomial for each element of array A.
Waves = [sin(T), cos(T)]; Envelope = abs(sin(T))
Expands to three series: sin(T), cos(T), and abs(sin(T)), with "Waves[0]", "Waves[1]", and "Envelope" as legend labels.
RedcrabX Plot Input Guide | Generated for ScottPlot-based Plot Box