Gnuplot
Gnuplot is a terminal based plotting application. This means that you interact with gnuplot by typing commands at a prompt. This turns out to be very convenient, because it means that you can always save or create a gnuplot configuration into a plain text file.
Plotting
basic plotting
gnuplot is a program created to plot stuff. You can plot functions or data. There are two commands for plotting, plot
and splot
. plot
is used to plot 2D functions while splot
is used to plot 3D functions. The plot
command has the following form
gnuplot> plot [ function | 'filename' ] [ modifiers ]
gnuplot has great support for all common (and many uncommon) functions. For example, to plot sin(x),
gnuplot> plot sin(x)
Multiple functions can be plotted on the same graph, just separate each with a comma
gnuplot> plot sin(x), cos(x)
We control the what and how our plot is displayed by setting options. Options are set with the set
command. For example, to set the graph title, we set the title
option to a string containing the title.
gnuplot> set title "Sine and Cosine"
Notice that the graph does not change after you set the title option. Gnuplot will not redraw the graph until we either issue another plot
command, or tell it to replot what we previously plotted with the ...replot
command.
gnuplot> replot # redraw the previous plot with new options