Gnuplot Tutorials
These tutorials teach gnuplot the way it is actually used: one complete, runnable script per topic, explained line by line. Work through them in order if you are new — each one assumes only the ones before it — or jump straight to the chart type you need. Every script runs in gnuplot 6.0, and every one can be pasted into the Gnuplot Online terminal to practise in your browser while you read, with nothing to install. If you do want gnuplot on your own machine, start with the installation guide and the download page.
Getting started
- Your First Gnuplot Plot — Draw sin(x), label the axes, and save the result as a PNG — the four ideas every gnuplot script builds on.
- Plot CSV Data in Gnuplot — Read comma-separated files with the right separator, pick columns with using, and turn the header row into legend titles.
- Titles, Labels and the Key — Set the plot title, axis labels and legend position, and control the font size of every text element.
- Line Styles, Colors and Point Types — Style curves with exact RGB colors, line widths, dash patterns and marker symbols, saved as reusable line styles.
- Axis Ranges, Tics and Log Scales — Fix the visible window, place tics where you want them, format numbers, and switch an axis to a log scale.
Chart types
- Error Bars in Gnuplot — Show measurement uncertainty with yerrorbars, using symmetric deltas or explicit low/high columns.
- Histograms in Gnuplot — Bin raw measurements into a frequency histogram, and use the built-in histogram style for pre-counted categories.
- Boxplots in Gnuplot — Summarise distributions with quartiles, whiskers and outliers computed straight from raw data.
- Heatmaps with pm3d — Turn a matrix of values into a color map with pm3d map, a custom palette and a fixed color range.
- 3D Plots with splot — Render surfaces of two variables with hidden-line removal, pm3d coloring and a viewpoint you control.
Going further
- Multiplot Layouts — Combine several panels into one figure with a shared title and axes that line up across panels.
- Curve Fitting with fit — Fit a model function to data by least squares, with starting values, result errors and a data-plus-fit plot.
- Plotting Date and Time Data — Plot time series by matching timefmt to your file, and format the date labels on the axis your way.
Try it online: Each tutorial on this page was written to run in the online terminal as-is. Paste the script into the Gnuplot Online terminal and run it in your browser — no install needed. To run gnuplot locally instead, see the installation guide and the download page.
Go deeper: For a systematic walk through gnuplot from first plots to publication-ready figures, see Gnuplot in Action by Philipp K. Janert — Janert is a gnuplot developer, and the book is the most complete tutorial reference for the program. Affiliate link: see our Affiliate Disclosure.
