GnuPlot

WebHome | UnixGeekTools | Geekfarm | About This Site

Pointers

Reading from stream

    plot "< simulator.pl" u 1:($2*1e9) t "ExecTime" w lp
    plot "< awk '{print $1,sqrt($2*$3)}' foo.dat" u 1:2 t "Data" w lp

Example Usage

    # examples
    gnuplot> plot sin(x)
    gnuplot> splot -x**3 -y
    gnuplot> splot [-2:2] [-2:2] 2*(x**2 + y**2)*exp(-x**2 - y**2)
    gnuplot> set hidden3d
    gnuplot> replot

    # tweaks
    set style data dots
    set style data points
    set grid
    replot
    set logscale
    set nologscale

    # title
    plot "report.dat" using 1:3 smooth unique title "successful"

    # plot timerlog data
    set xdata time
    set timefmt "%H:%M:%S"
    plot "timer.dat" using 3:1
    plot "server.dat" using 3:1, "server2.dat" using 3:1

    # plot time/date data
    set xdata time
    set timefmt "%m/%d/%y"
    set xrange ["03/21/95":"03/22/95"]
    set format x "%m/%d"
    set timefmt "%m/%d/%y %H:%M"
    plot "data" using 1:3

    # do some math while plotting
    gnuplot> plot "test.dat" using 1:2          with points,\
                  "test.dat" using 1:($2*2)     with points,\
                  "test.dat" using 1:(sqrt($2)) with points,\
                  "test.dat" using 1:(log($2))  with points

    # Plot raw counts of long response times
    plot "server3.dat" using 3:( $1>5 ? $1 : 0 ) smooth frequency,\
         "server3.dat" using 3:( $1 > 10 ? $1 : 0 ) smooth frequency,\
         "server3.dat" using 3:( $1 > 20 ? $1 : 0 ) smooth frequency

    plot "server2.dat" using 3:1,\
         "server2.dat" using 3:( $1>5 ? $1 : 0 ),\
         "server2.dat" using 3:( $1 > 10 ? $1 : 0 )

    # replotting
    set xrange [ "00:00" : "23:00" ]
    set yrange [ 0 : 20 ]
    replot

Description

Gnuplot is a portable command-line driven interactive datafile (text or binary) and function plotting utility for UNIX, IBM OS/2, MS Windows, DOS, Apple Macintosh, VMS, Atari and many other platforms. The software is copyrighted but freely distributed (i.e., you don't have to pay for it). It was originally intended as graphical program which would allow scientists and students to visualize mathematical functions and data. It does this job pretty well, and in addition it serves as non-interactive plotting engine for miscellaneous portable third-party applications, like Octave. Gnuplot is developed and supported since 1986, and having its scripts and commands easy to understand text files, it is time-portable as well.

Gnuplot supports various kinds of plots. In 2D, it can draw line, point, dot, box, histogram graphs or vector fields. In 3D, it supports line, point and dot surfaces, with or without hidden line removal. It supports color or grayscale surfaces and maps, even for non-equidistant and non-rectangular 3D data, otherwise it offers data gridding.

Gnuplot supports many different types of terminals: interactive screen terminals (with mouse and hotkey functionality), pen plotters (like hpgl), printers (including postscript and many color devices), and printings to output file as vectorial pseudo-devices like LaTeX, metafont, pdf, svg, or bitmap png. Gnuplot is easily extensible to include new devices. source???

- requires AquaTerm

Time format

     +---------+------------------------------------------------------------------+
     |  Format |                    Explanation                                   |
     +---------+------------------------------------------------------------------+
     |    %d   |       day of the month, 1--31                                    |
     |    %m   |       month of the year, 1--12                                   |
     |    %y   |       year, 0--99                                                |
     |    %Y   |       year, 4-digit                                              |
     |    %j   |       day of the year, 1--365                                    |
     |    %H   |       hour, 0--24                                                |
     |    %M   |       minute, 0--60                                              |
     |    %S   |       second, 0--60                                              |
     |    %b   |       three-character abbreviation of the name of the month      |
     |    %B   |       name of the month                                          |
     +---------+------------------------------------------------------------------+



Updated Sun Jul 23, 2006 12:11 PM