gnuplot
Plot functions and data graphically
TLDR
Start the interactive graph plotting shell
Plot the graph for the specified graph definition file
Set the output format by executing a command before loading the definition file
Persist the graph plot preview window after gnuplot exits
SYNOPSIS
gnuplot [-p] [-d] [-s] [-V] [-c scriptfile [arg1 ...]] [-r scriptfile [arg1 ...]] [-e "command list"] [file ...]
PARAMETERS
-p, --persist
Leaves plot windows open after gnuplot exits.
-d, --dump-options
Dumps all current options to stdout.
-e, --execute "command list"
Executes specified gnuplot commands before loading any script files or entering interactive mode. Useful for quick plots or settings.
-s, --synchronous
Runs gnuplot synchronously, useful when used from shell scripts.
-V, --version
Prints the gnuplot version and exits.
-c, --call
Executes the specified script file, passing subsequent arguments to it.
-r, --replot-only
Similar to -c, but primarily for replotting on an existing terminal, often used in conjunction with interactive sessions.
-q, --quiet
Starts in quiet mode, suppressing startup messages.
DESCRIPTION
Gnuplot is a portable, command-line driven graphing utility for Linux and other operating systems. It is widely used in scientific and engineering fields to visualize mathematical functions and data interactively or from scripts. Gnuplot supports numerous plot types, including 2D (lines, points, impulses, boxes, error bars, etc.) and 3D (surfaces, contours, splot). It can read data from files, pipe input, or plot functions defined directly. A key feature is its support for a vast array of output terminals, allowing plots to be saved in various formats like PNG, JPEG, SVG, PDF, PostScript, LaTeX, and more, making it suitable for both on-screen viewing and publication-quality graphics. Its scripting capabilities enable complex plot automation, data analysis, and highly customized visualizations.
CAVEATS
Steep Learning Curve:
While powerful, gnuplot's command-line interface and extensive options can be daunting for beginners.
No Native GUI:
Gnuplot is not a typical click-and-drag GUI application. All interactions are via commands, though it can open interactive plot windows.
Data Formatting:
Requires data to be well-structured (e.g., columns of numbers) or necessitates preprocessing using other tools like awk or sed.
SCRIPTING AND AUTOMATION
Gnuplot excels at creating complex, publication-quality plots from scripts. This allows for reproducible analysis, batch processing of data, and highly customized visualizations without manual intervention.
OUTPUT TERMINALS
It supports a vast range of output formats ("terminals"), including interactive window systems (x11, wxt, qt), bitmap images (png, jpeg, gif), vector graphics (svg, postscript, pdf, eps), and specialized formats for LaTeX/TeX integration. This flexibility ensures plots can be used in almost any context.
INTERACTIVE VS. BATCH MODE
Gnuplot can be used interactively, allowing users to type commands and see plots update in real-time. Alternatively, it can run in batch mode by executing a script file, making it ideal for automated report generation or data processing pipelines.
HISTORY
Gnuplot was originally developed in 1986 by Colin Kelley and Thomas Williams. Its name, "gnuplot", was a compromise to avoid conflicts with "newplot" and to acknowledge the GNU Project (though it is not part of the GNU Project itself, nor does it use the GNU General Public License, but rather its own permissive license). It quickly gained popularity in academic and research communities due to its flexibility, portability, and high-quality output capabilities, becoming a de-facto standard for scientific data visualization on Unix-like systems. Development has been continuous, with new features, plot styles, and output terminals added over decades.