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

30

gnuplot 4.6

For data in a le, plot the average of the data in columns 2 and 3 against the datum in column 1, but only if the datum in column 4 is non-negative:

plot 'file' using 1:( $4<0 ? 1/0 : ($2+$3)/2 )

For an explanation of the using syntax, please see plot data le using (p. 83).

Summation

A summation expression has the form

sum [<var> = <start> : <end>] <expression>

<var> is treated as an integer variable that takes on successive integral values from <start> to <end>. For each of these, the current value of <expression> is added to a running total whose nal value becomes the value of the summation expression. Examples:

print sum [i=1:10] i 55.

# Equivalent to plot 'data' using 1:($2+$3+$4+$5+$6+...) plot 'data' using 1 : (sum [col=2:MAXCOL] column(col))

It is not necessary that <expression> contain the variable <var>. Although <start> and <end> can be speci ed as variables or expressions, their value cannot be changed dynamically as a side-e ect of carrying out the summation. If <end> is less than <start> then the value of the summation is zero.

Gnuplot-de ned variables

Gnuplot maintains a number of read-only variables that re ect the current internal state of the program and the most recent plot. These variables begin with the pre x "GPVAL ". Examples include GPVAL TERM, GPVAL X MIN, GPVAL X MAX, GPVAL Y MIN. Type show variables all to display the complete list and current values. Values related to axes parameters (ranges, log base) are values used during the last plot, not those currently set.

Example: To calculate the fractional screen coordinates of the point [X,Y]

GRAPH_X = (X - GPVAL_X_MIN) / (GPVAL_X_MAX - GPVAL_X_MIN) GRAPH_Y = (Y - GPVAL_Y_MIN) / (GPVAL_Y_MAX - GPVAL_Y_MIN)

SCREEN_X = GPVAL_TERM_XMIN + GRAPH_X * (GPVAL_TERM_XMAX - GPVAL_TERM_XMIN) SCREEN_Y = GPVAL_TERM_YMIN + GRAPH_Y * (GPVAL_TERM_YMAX - GPVAL_TERM_YMIN) FRAC_X = SCREEN_X / GPVAL_TERM_XSIZE

FRAC_Y = SCREEN_Y / GPVAL_TERM_YSIZE

The read-only variable GPVAL ERRNO is set to a non-zero value if any gnuplot command terminates early due to an error. The most recent error message is stored in the string variable GPVAL ERRMSG. Both GPVAL ERRNO and GPVAL ERRMSG can be cleared using the command reset errors.

Interactive terminals with mouse functionality maintain read-only variables with the pre x "MOUSE ". See mouse variables (p. 37) for details.

The t mechanism uses several variables with names that begin "FIT ". It is safest to avoid using such names. "FIT LIMIT", however, is one that you may wish to rede ne. Under set t errorvariables, the error for each tted parameter will be stored in a variable named like the parameter, but with " err" appended. See the documentation on t (p. 62) for details.

See user-de ned variables (p. 30), reset errors (p. 94), mouse variables (p. 37), and t (p. 62).

User-de ned variables and functions

New user-de ned variables and functions of one through twelve variables may be declared and used anywhere, including on the plot command itself.

User-de ned function syntax:

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