University of Virginia Department of
    Computer Science

Introduction

From the Gnuplot FAQ:
Gnuplot is a command-driven interactive function plotting program. It can be used to plot functions and data points in both two- and three- dimensional plots in many different formats, and will accommodate many of the needs of today's scientists for graphic data representation. Gnuplot is copyrighted, but freely distributable; you don't have to pay for it.
Probably the best way to learn gnuplot is to start using it. It has pretty good help built in, and the only command you really need to know is "plot".

Running Gnuplot

From the command line, type "gnuplot" - this brings the program up in interactive mode. Type "help" for general help, or "help subject" to learn about specifics. "help plot" is probably the most useful thing you can type.

You can give gnuplot commands interactively, or load chunks of code with the load command.

Generating Graphs in EPS

Once you have a graph that you want to include in a document, you need to tell gnuplot to generate encapsulated postscript. To do this, type "set terminal postscript eps" and "set output outfile.ps". Then type "replot" - this should generate the postscript. Reset output and terminal type to the defaults by typing "set output" and "set terminal x11".

Example

Here is a solution in gnuplot to exercise 1.1a from Computer Architecture A Quantitative Approach which displays the graph on the screen:

set xlabel "Percent vectorization"
set ylabel "Net speedup"
plot [x=0:100] 1/((1-(0.01*x))+((0.01*x)/20)) notitle
This program creates an eps version of the graph called "1.1.ps":
set terminal postscript eps
set output "1.1.ps"
set xlabel "Percent vectorization"
set ylabel "Net speedup"
plot [x=0:100] 1/((1-(0.01*x))+((0.01*x)/20)) notitle
set output
set terminal x11

Also See



HelpNet
HelpNet was created by the 1995 incoming graduate class. It is only occasionally updated.
Department of Computer Science
School of Engineering, University of Virginia
151 Engineer's Way, P.O. Box 400740
Charlottesville, Virginia 22904-4740

(434) 982-2200  Fax: (434) 982-2214
Web Comments: webteam@cs.virginia.edu
Admissions Inquiries: inquiry@cs.virginia.edu
Site directory, Other addresses
Server statistics
© Created by the CS Web Team