Functions were lesson one; real work plots data. Gnuplot takes data inline in the script — the classic plot '-' form — so the numbers and their plot live together in one place.
Step 1 — Inline data
Everything between plot '-' and the lone e is your data, one point per line:
set xlabel "Time (h)"
set ylabel "Signal"
plot '-' with points pointtype 7 title "measured"
1 2.1
2 3.9
3 8.3
4 15.8
5 31.0
6 44.2
e
with points draws markers only — data are points; pointtype 7 is the filled circle.
Step 2 — Pick columns with using
With more columns, using selects which are x and y — here column 1 vs column 3:
set xlabel "Time (h)"
set ylabel "Signal"
plot '-' using 1:3 with points pointtype 7 title "run 2"
1 2.1 1.9
2 3.9 4.2
3 8.3 7.9
4 15.8 16.4
5 31.0 30.1
e
Step 3 — Error bars
A third using column feeds yerrorbars:
set xlabel "Time (h)"
set ylabel "Signal"
plot '-' using 1:2:3 with yerrorbars pointtype 7 title "measured"
1 2.1 0.4
2 3.9 0.5
3 8.3 0.9
4 15.8 1.4
5 31.0 2.2
e
Step 4 — Data and model together
Repeat the inline block once per plotted item — points for the data, a function for the model:
set xlabel "Time (h)"
set ylabel "Signal"
set key top left
plot '-' using 1:2:3 with yerrorbars pointtype 7 title "measured", \
1.15*x**2 with lines linewidth 2 title "model"
1 2.1 0.4
2 3.9 0.5
3 8.3 0.9
4 15.8 1.4
5 31.0 2.2
e
The model is a live expression — change 1.15 and Run to see the fit quality move.
Step 5 — Export or insert
Export / Insert: vector PDF for LaTeX or straight into the paper with a \label; the script (data included) is what gets saved, so the figure always reproduces.
Tip: Keep the data block pasted straight from your instrument or spreadsheet — whitespace-separated columns are exactly what Gnuplot wants, and having the numbers verbatim in the saved script is its own kind of lab notebook.