A single script is fine for a single plot. An analysis — load the data, check it, transform it, then plot — wants stages you can rerun independently. That is the Notebook: multiple Python cells, run one at a time or all in order, with each cell’s printed output captured beneath it.

Step 1 — Open the Notebook

In Figure Studio, open the Notebook. You get a stack of cells; each holds Python, and Run All executes them top to bottom.

Step 2 — Cell 1: load and inspect

Keep loading separate, and print what you loaded — the captured output is your sanity check:

import numpy as np

data = np.loadtxt("measurements.csv", delimiter=",")
print(data.shape)
print(data[:3])

The shape and the first rows appear under the cell. If the file has a header row or the delimiter is wrong, you find out here — not as a confusing plot two cells later.

Step 3 — Cell 2: transform

Variables carry over between cells, so the next stage just uses data:

x, y = data[:, 0], data[:, 1]
mask = y > 0          # drop the bad rows
x, y = x[mask], y[mask]
print(f"kept {len(y)} points")

Step 4 — Cell 3: plot

import matplotlib.pyplot as plt

plt.scatter(x, y, s=8)
plt.xlabel("time (s)")
plt.ylabel("signal")

Because the stages are separate, tweaking the plot means rerunning only this cell — the load and the cleanup stay put.

Step 5 — Run All, then export

Run All executes the cells in order — the guarantee that the figure really is the product of the code above it, not of some stale variable. Then Export / Insert as usual: vector PDF for LaTeX, or into the paper with a \label.

Tip: One job per cell. When a cell does two things, the day you need to rerun half of it is the day you split it anyway.