PlotlyPublisher#

class PlotlyPublisher(
figure: go.Figure | go.FigureWidget | None = None,
max_points: int = 10_000,
flush_interval: float = 0.1,
time_window_s: float | None = None,
)[source]#

Bases: object

Plot Measurement/Command data on a Plotly figure, one trace per channel.

Requires the plot extra (pip install "instro[plot]").

Create a publisher that plots each channel on a trace named after the channel.

Parameters:
  • figure

    Figure to plot on. A go.FigureWidget updates live in a notebook. When omitted, the publisher creates a go.FigureWidget, displays it right away, and shows it again on close().

  • max_points

    Points kept per channel; older points drop off the plot.

  • flush_interval

    Seconds between writes to the figure.

  • time_window_s

    Seconds of data the x axis shows, or None (the default) to autoscale. The window starts at the first point and scrolls forward.

Methods

close

Stop the flush thread, write any remaining points to the figure, and clear the buffers.

publish

Buffer data for the next write to the figure.

publish(
data: Measurement | Command,
**kwargs,
) → None[source]#

Buffer data for the next write to the figure.

close() → None[source]#

Stop the flush thread, write any remaining points to the figure, and clear the buffers.