Gnuplot Examples & Scripts

Every example on this page is a complete, copy-and-run gnuplot 6.0 script with a short line-by-line explanation. You do not need to install anything to try them: each script runs in the Gnuplot Online terminal — open it, paste a script, and run it in your browser. If you prefer working locally, the installation guide and the download page cover every platform.

Data charts

Scatter Plot — One point per observation, with point size and color driven by extra data columns.

Candlestick Chart — Financial OHLC candles from an inline data block, with the five-column order explained.

Bar Chart — Category bars with labels taken straight from the data using xtic.

Data Smoothing — Raw points plotted together with smooth csplines and smooth bezier curves.

Filled Curves — Shade the band between two curves, or between a curve and the axis.

Math & functions

Function Plot Examples — sin/cos, exp/log, and scaled polynomials — three complete function scripts.

Polar Plot — Polar coordinates with set polar and trange, drawing a three-petal rose.

Vector Field — Arrows from x, y, dx, dy columns with the vectors style.

3D & special

Contour Plot — A flat contour map with set contour and cntrparam, surface hidden.

Surface Plot (pm3d) — A height-colored 3D surface with pm3d, a palette, and a colorbox.

Animated GIF — A traveling-wave animation built with gif animate and a do for loop.

Go deeper: For a systematic tour of gnuplot plotting styles and scripts, see Gnuplot in Action — its author, Philipp K. Janert, is a gnuplot developer. Affiliate link: see our Affiliate Disclosure.