College of Engineering Logo Web Server Logs Student Server Logs Orange bar Main Page General Information Special Events Programs Research Student Information Computer Facility Outreach Xtreme Engineering Jobs Available

Everything about Gnuplot in one page

Computer Facility University of Hawaii at Manoa
College of Engineering

Features:

  • case-sensitive
  • commands can be abbreviated
  • strings with double or single quotes
  • command line arguments are gnuplot files
  • command line extensions with backslash
  • command line editing
    ^B
    back a char
    ^F
    forward a char
    ^A
    beginning of line
    ^E
    end of line
    ^H,DEL
    delete previous character
    ^D
    delete current character
    ^K
    delete from current position to end of line
    ^L,^R
    redraw line
    ^U
    delete entire line
    ^W
    delete current word
    ^P
    move back through history
    ^N
    move forward through history
  • # - comment; Comments with line ending in \ (backslash) are continued, character does not take effect within quotes, numbers, or command substitutions
  • data files
    • specified in the command line with quotes - file names beginning with "<" are used as commands to provide output.
    • # is used as a comment within the data file
    • one data point per line, separated by spaces.
    • You can give the data files different formats, by the "using" followed by the format of the data file.
  • environment - Gnuplot understands these values
    • GNUTERM - term type for gnuplot to use (overridden by) .gnuplot
    • GNUHELP - location of gnuplot help file
    • HOME - directory to search for .gnuplot file
    • PAGER - output filter for help messages
    • SHELL - used for shell command
  • expressions - Any mathematical expression in C, Fortran, Pascal or BASIC is valid. Precendence is defined as same in C language. spaces are ignored within expressions. Complex constants -- {x,y} = x + y * i. (required braces)
  • functions - Supports functions from the C math library
    Function (Arguments)
    Returns
    abs(x) (any)
    absolute value of x
    abs(x) (complex)
    length of x
    acos(x) (any)
    arccosine in radians
    arg(x) (complex)
    the phase of x in radians
    asin(x) (any)
    arcsin in radians
    atan(x) (any)
    arctangent in radians
    besj0(x) (radians)
    j_0 bessel function of x
    besj1(x) (radians)
    j_1 bessel function of x
    besy0(x) (radians)
    y_0 bessel function of x
    besy1(x) (radians)
    y_1 bessel function of x
    ceil(x) (any)
    smallest integer not less than real (x)
    cos(x) (radians)
    cosine x
    cosh(x) (radians)
    hyperbolic cosine x
    erf(x) (any )
    Erf(real(x)), error function of real(x)
    erfc(x) (any)
    Erfc(real(x)), 1.0 - error function of real(x)
    exp(x) (any)
    exponential function of x
    floor(x) (any)
    largest integer not greater than real(x)
    gamma(x) (any)
    gamma function of real (x)
    ibeta(p,q,x) (any)
    ibeta function of real(p,q,x)
    igamma(a,x) (any)
    igamma function of real(a,x)
    imag(x) (complex)
    imaginary part of x
    invnorm(x) (any)
    inverse normal distribution function of real(x)
    int(x) (real)
    real integer part of x
    lgamma(x) (any)
    lgamma function of real(x)
    log(x) (any)
    natural logarithm of x
    log10(x) (any)
    logarithm base 10 of x
    norm(x) impulses | dots | steps | errorbars
    linetype,pointtype := integers indicating what type (color) of line and point to use for the plot
    print
    prints value of an expression
    pwd
    current working directory
    replot
    replots last plot, or adds one if one is specified.
    reread
    go back to the beginning of the currente AND (integers only)
    ^
    a ^ b - bitwise exclusive OR (integers only)
    |
    a | b - bitwise inclusive OR (integers only)
    &&
    a && b - logical AND (integers only)
    ||
    a || b - logical OR (integers only)
    ?:
    a ? b : c - ternary operator
    -
    - a - unary minus
    ~
    ~ a - one's complement (integers only)
    !
    ! a - logical negation (integers only)
    !
    a ! - factorial (integers only, returns real number)
  • Startup environment - .gnuplot file loaded before other files (current dir, home dir)
  • Command substitution - use backquotes, like in a shell
  • User-defined functions/variables
    • variable = constant
    • function(dummy) = expression

Commands:

Note: The following convention is used in the description of the commands: Curly braces - optional arguments, vertical bar - mutually exclusive options, keywords - bold, tokens - monospaced

cd
requires quotes
clear
clears screen, formfeed for hardcopy, needs terminal type
exit,quit
exit gnuplot, clears output device
help {topic}
gives a help screen or a series of help screens
load "filename"
executes the specified files as if they were typed in nested loads are allowed. quotes are required.
pause time {"string"}
pauses for the predetermi ned interval. -1 waits for return.
plot { ranges } { function | {"datafile" { using data-format }}} { title } { style } {, function {title} {style}...}
splot { ranges } { function | {"datafile" {index i} { using data-format }}} { title } { style } {, function {title} {style}...}
plots 2d,3d functions (or surfaces) and data (see data files)
ranges := [n1:n2] | [var=n1:n2]
data-format := { ycol | xcol:ycol | xcol:ycol:ydelta | xcol:ycol:ylow:yhigh | }
style := with style-type { linetype { pointtype }}
style-type := lines | points | linespoints | impulses | dots | steps | errorbars
linetype,pointtype := integers indicating what type (color) of line and point to use for the plot
print
prints value of an expression
pwd
current working directory
replot
replots last plot, or adds one if one is specified.
reread
go back to the beginning of the current input file
save
saves Gnuplot's environment, including the last plot made.
set
sets options
angles
{ degrees | radians (default) }
arrow
{tag} {from x,y{,z}} {to x, y{, z}} {{no}head}
noarrow
removes arrow (or all)
autoscale
axes axes := x,y,z or xy
noautoscale
border
makes a border for plots
noborder
boxwidth
sets width of box for box styles
clabel
turn on contour labels
noclabel
clip
clip-type clip-type := points (omit edge points), one (plot only lines with one endpoint), two (plot lines that pass through visible portion)
noclip
cntrparam
contour parameters { { linear | cubicspline | bspline } | points n | order n | levels { [ auto ] n | discrete z1, z2, ... | incremental {start, incr{, end} } } }
contour
{ base | surface | both } contour drawing
nocontour
datastyle
{ style-choice } default plotting style style-choice := lines, points, linespoints, dots, steps, impulses he options settings
title
sets the title of the plot

Author: Ben Yoshino (ben@wiliki.eng.hawaii.edu)

Comments, Questions? | E-mail: webmaster@wiliki.eng.hawaii.edu


Last updated on Thursday, August %.1d, 2002
Copyright © 2001 University of Hawai`i, College of Engineering, Computer Facility
All rights reserved.