Skip to content

viz#

Draw signals, spectra, and figures in the app's plots.

plot puts a signal or spectrum on the main plot; annotate overlays a reference curve without replacing the data; show_figure displays a complete chart you built yourself. The rest control axes and clear what's on screen.

annotate #

annotate(
    data: Signal1D
    | Spectrum1D
    | Figure
    | ndarray
    | list[float]
    | list[int]
    | tuple[ndarray, ndarray]
    | tuple[list[float], list[float]],
    title: str | None = None,
    kind: Literal["signal", "spectrum", "auto"] = "auto",
    id: str | None = None,
) -> None

Overlay a reference curve on the plot without replacing the data.

Like plot, but the curve is drawn as an annotation: it is not saved as the current signal/spectrum and does not clear existing curves. Good for reference lines, fits, or overlays shown alongside the data.

A charts.Figure is also accepted: its series are overlaid on the current plot (keeping the existing layout). Like plot, the overlay is transient — the next normal signal/spectrum push reverts the plot.

Parameters:

Name Type Description Default
data Signal1D | Spectrum1D | Figure | ndarray | list[float] | list[int] | tuple[ndarray, ndarray] | tuple[list[float], list[float]]

The data to overlay — a signal/spectrum, a y-array, an (x, y) pair, or a charts.Figure.

required
title str | None

Label for the overlay.

None
kind Literal['signal', 'spectrum', 'auto']

How to treat the data — "signal", "spectrum", or "auto" (auto requires a Signal/Spectrum object). For a charts.Figure on the main plot, kind selects the signal vs spectrum surface ("auto" → spectrum).

'auto'
id str | None

Target a specific plot on a custom page; leave None for the main plot.

None

clear_annotations #

clear_annotations(
    scope: Literal["all", "signal", "spectrum"],
) -> None

Remove overlay annotations (added with annotate).

Parameters:

Name Type Description Default
scope Literal['all', 'signal', 'spectrum']

Which to clear — "all", only the "signal" plot's, or only the "spectrum" plot's.

required

clear_plots #

clear_plots() -> None

Remove every curve from all plots.

plot #

plot(
    data: Signal1D
    | Spectrum1D
    | Figure
    | ndarray
    | list[float]
    | list[int]
    | tuple[ndarray, ndarray]
    | tuple[list[float], list[float]],
    kind: Literal["signal", "spectrum", "auto"] = "auto",
    title: str | None = None,
    save_to_state: bool = True,
    clear: bool = True,
    id: str | None = None,
) -> None

Draw a signal, spectrum, or custom charts figure on the plot.

Accepts a Signal/Spectrum object, a single array (plotted against its index), an (x, y) pair, or a charts.Figure — which is rendered with its full layout natively on the plot (replacing whatever is there). The figure is transient: the next normal plot/annotate of a signal or spectrum reverts the plot to the standard layout.

Parameters:

Name Type Description Default
data Signal1D | Spectrum1D | Figure | ndarray | list[float] | list[int] | tuple[ndarray, ndarray] | tuple[list[float], list[float]]

The data to plot — a signal/spectrum, a y-array, an (x, y) pair, or a charts.Figure.

required
kind Literal['signal', 'spectrum', 'auto']

How to treat the data — "signal", "spectrum", or "auto". With "auto" the data must already be a Signal or Spectrum object so its kind is known; for raw arrays, name it explicitly. For a charts.Figure on the main plot, kind selects the signal vs spectrum surface ("auto" → spectrum).

'auto'
title str | None

Label for the plotted curve.

None
save_to_state bool

Also store the data as the current signal/spectrum (so other tools can use it). Ignored for a charts.Figure.

True
clear bool

Remove existing curves before drawing this one.

True
id str | None

Target a specific plot on a custom page; leave None for the main plot.

None

set_axes #

set_axes(
    x: Literal["linear", "log"] = "linear",
    y: Literal["linear", "log"] = "linear",
) -> None

Switch the plot axes between linear and logarithmic scaling.

Applies to both the signal and spectrum plots.

Parameters:

Name Type Description Default
x Literal['linear', 'log']

X-axis scale — "linear" or "log".

'linear'
y Literal['linear', 'log']

Y-axis scale — "linear" or "log".

'linear'

show_figure #

show_figure(
    figure: Figure
    | Figure
    | ndarray
    | bytes
    | bytearray
    | str,
    id: str | None = None,
    title: str | None = None,
    dpi: int = 150,
    width: int | None = None,
    height: int | None = None,
) -> None

Display a complete figure (chart/image) in the analysis panel.

Renders the figure to an image and shows it in the Multi-Scan Analysis figures panel. Calling again with the same id replaces the previous figure in place — handy for live updates.

Parameters:

Name Type Description Default
figure Figure | Figure | ndarray | bytes | bytearray | str

The figure to show — a charts figure, a matplotlib or plotly figure, a PIL image, a numpy image array, or PNG bytes.

required
id str | None

Reuse the same value to update a figure in place; defaults to the title (or "figure").

None
title str | None

Caption shown above the figure.

None
dpi int

Output resolution in dots per inch.

150
width int | None

Optional width in pixels.

None
height int | None

Optional height in pixels.

None

show_table #

show_table(
    data: Any
    | Mapping[str, Sequence[Any]]
    | tuple[Sequence[str], Sequence[Sequence[Any]]]
    | Sequence[Sequence[Any]],
    id: str | None = None,
    title: str | None = None,
    caption: str | None = None,
) -> None

Display a simple table in the analysis panel, alongside figures.

Useful when you want to inspect metrics without (or together with) charts. Calling again with the same id replaces the previous table in place.

Parameters:

Name Type Description Default
data Any | Mapping[str, Sequence[Any]] | tuple[Sequence[str], Sequence[Sequence[Any]]] | Sequence[Sequence[Any]]

The table — a pandas DataFrame, a mapping of column name to values, or a (columns, rows) pair / list of row sequences.

required
id str | None

Reuse the same value to update a table in place; defaults to the title (or "table").

None
title str | None

Caption shown above the table.

None
caption str | None

Optional secondary caption.

None