Python with matplotlib is the workhorse of scientific plotting. This lesson builds a styled plot from scratch in the Code editor and ends with it in your paper.
Step 1 — Open the Python mode
In Figure Studio, open the Code tab and pick Python. Write the script on the left, press Run, and the figure renders in the preview.
Step 2 — Plot a curve
The minimal scientific plot — generate points, draw them:
import matplotlib.pyplot as plt
import numpy as np
x = np.linspace(0, 2 * np.pi, 200)
plt.plot(x, np.sin(x))
np.linspace gives 200 evenly spaced x-values; plt.plot connects the points. Run it and the sine curve appears.
Step 3 — Label the axes
An unlabelled plot is a sketch, not a figure:
import matplotlib.pyplot as plt
import numpy as np
x = np.linspace(0, 2 * np.pi, 200)
plt.plot(x, np.sin(x))
plt.xlabel("x")
plt.ylabel("sin x")
Step 4 — Add a second curve and a legend
Each plt.plot call adds a line; label plus plt.legend() builds the legend:
import matplotlib.pyplot as plt
import numpy as np
x = np.linspace(0, 2 * np.pi, 200)
plt.plot(x, np.sin(x), label="sin x", linewidth=2)
plt.plot(x, np.cos(x), label="cos x", linewidth=2, linestyle="--")
plt.xlabel("x")
plt.ylabel("amplitude")
plt.legend()
plt.grid(alpha=0.3)
The dashed second curve stays readable if the journal prints in black and white.
Step 5 — Export or insert
Pick a Journal Style in the side panel to match a venue’s fonts and sizing, then Export / Insert: a vector PDF for LaTeX, or straight into the current paper with a \label. The script is what gets saved — reopen the figure later and you are back here, editing the code that made it.
Tip: Real data usually arrives as a file.
np.loadtxt("data.csv", delimiter=",")reads a numeric CSV into an array — and once a script grows into load-then-transform-then-plot, move to the Notebook (next lesson) so each stage runs as its own cell.