Working with data

The x-axis model

Every trace is plotted against a shared x-axis. You control which axis, and its units.

The default axis

When a source is opened, its traces are plotted against the row index — 0, 1, 2, … — shown as the index row in the source browser.

The index row is not plottable; it shows the default axis and holds its transform.

Refract does not promote a file's first column to the x-axis; assign one explicitly.

X-axis transforms

A transform applies x × scale + offset. Open it from the context menu of the index row or any trace used as an x-axis: Set X-Axis Transform…

Unitless
Scale and offset, with no unit.
Seconds
Scale and offset, in seconds. For data sampled every millisecond, scale = 0.001.
Hz
Enter a sample rate instead of a scale. The resulting axis is in seconds.

Apply commits; Reset restores the default. The current transform appears as a badge beside the row, for example @ 48000Hz or × 0.001s.

Audio files are configured automatically from their sample rate.

Assigning a custom x-axis

Drag the trace you want to plot onto the trace that should become its x-axis. The target gains a ruler icon, and dependent traces are indented beneath it.

Default: row index on x 0 index → n Each sample one step along. Every source starts here. Assigned: another signal's values on x 0 voltage → Same samples, plotted against voltage instead.
Left: the implicit row-index axis. Right: current assigned to take voltage as its x-axis.

Multi-select works: drag several traces onto one target.

Assignments are limited to traces in the same source, and the same table for RefractIO connections. Computed signals cannot be reassigned — their axis comes from their inputs.

An x-axis trace can carry its own transform, so a millisecond counter can be scaled to seconds without editing the file.

Removing an assignment

  • Reset X-Axis to Index returns one trace to the source default.
  • Remove as X-Axis returns all of a trace's dependents at once.
Tip

A custom x-axis need not increase. Plotting current against voltage produces a phase-plane or hysteresis curve, drawn as recorded.

Units

An axis unit determines whether two signals can be combined in a formula.

UnitDimensionNotes
UnitlessnoneCombines with anything.
Secondstime
HztimeProduces a seconds axis.

Because Hz and Seconds share a dimension, an audio channel and a CSV column with a seconds timestamp can be used together. Axes with different dimensions are rejected with an incompatible units error.

How axes are combined

When a formula reads signals on different grids, Refract merges their x-values into one sorted axis and forward-fills each input onto it. Positions before an input's first sample are NaN.

fast slow merge into one sorted axis merged filled NaN Solid dots are the slow signal's own samples; pale dots are its last known value, carried forward.
Merge every x-value into one sorted axis, then fill each input forward.

The formula pane reports the merged axis: sample count, whether several axes were combined, and the range.

Streams

Live connections work the same way. Transform edits take effect immediately, and custom x-axis assignments are maintained as the window slides.