Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
pmi432 / LR02 / Books / gnuplot 4.6 manual.pdf
Скачиваний:
61
Добавлен:
18.03.2015
Размер:
2.22 Mб
Скачать

92

gnuplot 4.6

plot 'exper.dat' w lines, 'exper.dat' notitle w errorbars

Another way to plot "exper.dat" with errorlines (errorbars require three or four columns): plot 'exper.dat' w errorlines

This plots sin(x) and cos(x) with linespoints, using the same line type but di erent point types: plot sin(x) with linesp lt 1 pt 3, cos(x) with linesp lt 1 pt 4

This plots le "data" with points of type 3 and twice usual size: plot 'data' with points pointtype 3 pointsize 2

This plots le "data" with variable pointsize read from column 4

plot 'data' using 1:2:4 with points pt 5 pointsize variable

This plots two data sets with lines di ering only by weight:

plot 'd1' t "good" w l lt 2 lw 3, 'd2' t "bad" w l lt 2 lw 1

This plots lled curve of x*x and a color stripe:

plot x*x with filledcurve closed, 40 with filledcurve y1=10

This plots x*x and a color box:

plot x*x, (x>=-5 && x<=5 ? 40 : 1/0) with filledcurve y1=10 lt 8

This plots a surface with color lines: splot x*x-y*y with line palette

This plots two color surfaces at di erent altitudes:

splot x*x-y*y with pm3d, x*x+y*y with pm3d at t

Print

The print command prints the value of <expression> to the screen. It is synonymous with pause 0. <expression> may be anything that gnuplot can evaluate that produces a number, or it can be a string.

Syntax:

print <expression> {, <expression>, ...}

See expressions (p. 25). The output le can be set with set print.

Pwd

The pwd command prints the name of the working directory to the screen.

Note that if you wish to store the current directory into a string variable or use it in string expressions, then you can use variable GPVAL PWD, see show variables all (p. 155).

Quit

The exit and quit commands and END-OF-FILE character will exit gnuplot. Each of these commands will clear the output device (as does the clear command) before exiting.

gnuplot 4.6

93

Raise

Syntax:

raise {plot_window_nb}

The raise command raises (opposite to lower) plot window(s) associated with the interactive terminal of your gnuplot session, i.e. pm, win, wxt or x11. It puts the plot window to front (top) in the z-order windows stack of the window manager of your desktop.

As x11 and wxt support multiple plot windows, then by default they raise these windows in descending order of most recently created on top to the least recently created on bottom. If a plot number is supplied as an optional parameter, only the associated plot window will be raised if it exists.

The optional parameter is ignored for single plot-windows terminal, i.e. pm and win.

If the window is not raised under X11, then perhaps the plot window is running in a di erent X11 session (telnet or ssh session, for example), or perhaps raising is blocked by your window manager policy setting.

Refresh

The refresh command is similar to replot, with two major di erences. refresh reformats and redraws the current plot using the data already read in. This means that you can use refresh for plots with in-line data (pseudo-device '-') and for plots from data les whose contents are volatile. You cannot use the refresh command to add new data to an existing plot.

Mousing operations, in particular zoom and unzoom, will use refresh rather than replot if appropriate. Example:

plot 'datafile' volatile with lines, '-' with labels 100 200 "Special point"

e

# Various mousing operations go here set title "Zoomed in view"

set term post

set output 'zoom.ps' refresh

Replot

The replot command without arguments repeats the last plot or splot command. This can be useful for viewing a plot with di erent set options, or when generating the same plot for several devices.

Arguments speci ed after a replot command will be added onto the last plot or splot command (with an implied ',' separator) before it is repeated. replot accepts the same arguments as the plot and splot commands except that ranges cannot be speci ed. Thus you can use replot to plot a function against the second axes if the previous command was plot but not if it was splot.

N.B. | use of

plot '-' ; ... ; replot

is not recommended, because it will require that you type in the data all over again. In most cases you can use the refresh command instead, which will redraw the plot using the data previously read in.

Note that replot does not work in multiplot mode, since it reproduces only the last plot rather than the entire screen.

See also command-line-editing (p. 21) for ways to edit the last plot (p. 72) (splot (p. 167)) command.

See also show plot (p. 133) to show the whole current plotting command, and the possibility to copy it into the history (p. 69).

94

gnuplot 4.6

Reread

The reread command causes the current gnuplot command le, as speci ed by a load command or on the command line, to be reset to its starting point before further commands are read from it. This essentially implements an endless loop of the commands from the beginning of the command le to the reread command. (But this is not necessarily a disaster | reread can be very useful when used in conjunction with if.) The reread command has no e ect if input from standard input.

Examples:

Suppose the le "looper" contains the commands

a=a+1

plot sin(x*a) pause -1 if(a<5) reread

and from within gnuplot you submit the commands

a=0

load 'looper'

The result will be ve plots (separated by the pause message).

Suppose the le "data" contains six columns of numbers with a total yrange from 0 to 10; the rst is x and the next are ve di erent functions of x. Suppose also that the le "plotter" contains the commands

c_p = c_p+1

plot "$0" using 1:c_p with lines linetype c_p if(c_p < n_p) reread

and from within gnuplot you submit the commands

n_p=6 c_p=1 unset key

set yrange [0:10] set multiplot

call 'plotter' 'data' unset multiplot

The result is a single graph consisting of ve plots. The yrange must be set explicitly to guarantee that theve separate graphs (drawn on top of each other in multiplot mode) will have exactly the same axes. The linetype must be speci ed; otherwise all the plots would be drawn with the same type. See animate.dem in demo directory for an animated example.

Reset

The reset command causes all graph-related options that can be set with the set command to take on their default values. This command is useful, e.g., to restore the default graph settings at the end of a commandle, or to return to a de ned state after lots of settings have been changed within a command le. Please refer to the set command to see the default values that the various options take.

The following are not a ected by reset.

`set term` `set output` `set loadpath` `set fontpath` `set linetype` `set encoding` `set decimalsign` `set locale` `set psdir`

reset errors clears only the error state variables GPVAL ERRNO and GPVAL ERRMSG.

reset bind restores all hotkey bindings to their default state.

Соседние файлы в папке Books