Free since 2005 · No login required
AT

Academic Tutorials

Learn at your own pace

site-mobile-top-banner · 320x50

The Basics of gnuplot

Added 30 Jul 2008

Fire up gnuplot by typing gnuplot at the command prompt of your shell. The first thing you will see is the prompt sign >. The prompt is the point of input into gnuplot; Linux users will be used to its behavior. For example, you can use arrow keys to navigate the history of commands you have typed before, then edit and re-execute them; and the Home and End keys work as expected. gnuplot can be recompiled to use the GNU readline library to move around on the input prompt, but the defaults function similarly.

Gnuplot comes with extensive online help, which you cannot avoid using if you intend to do anything non-trivial. The syntax is uniform: help for any command is obtained by typing help . Go ahead and start up gnuplot, and try the commands help set yrange and help set now (use q to quit the help after each command). Notice that yrange is one of the sub-options available under help set. In general, gnuplot help offers further help for all possible customizations of a command. Glancing at the examples section in the help is usually more than sufficient to understand how to use a command.

Gnuplot also has an extensive set of demos that showcase its capabilities, usually located in the demo subdirectory of the install. To get the tour-de-force, change into this directory at the gnuplot prompt (for example, cd '/opt/gnuplot/demo' -- note that gnuplot requires all file and directory names to be enclosed in single or double quotes) and type in load 'all.dem'. Individual .dem files in this directory demonstrate individual functions, and all.dem loads them all one at a time. You may want to hold off on this exercise until the end of this article, though, so that we can get started without further ado...