Gnuplot-defined variables

Gnuplot maintains a number of read-only variables that reflect the current internal state of the program and the most recent plot. These variables begin with the prefix "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_SCALE / GPVAL_TERM_XSIZE
    FRAC_Y = SCREEN_Y * GPVAL_TERM_SCALE / 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 prefix "MOUSE_". See mouse variables (p. [*]) for details.

The fit mechanism uses several variables with names that begin "FIT_". It is safest to avoid using such names. When using set fit errorvariables, the error for each fitted parameter will be stored in a variable named like the parameter, but with "_err" appended. See the documentation on fit (p. [*]) and set fit (p. [*]) for details.

See user-defined variables (p. [*]), reset errors (p. [*]), mouse variables (p. [*]), and fit (p. [*]).