Pause

The pause command displays any text associated with the command and then waits a specified amount of time or until the carriage return is pressed. pause is especially useful in conjunction with load files.

Syntax:

pause <time> {"<string>"}
pause mouse {<endcondition>}{, <endcondition>} {"<string>"}
pause mouse close

<time> may be any constant or floating-point expression. pause -1 will wait until a carriage return is hit, zero (0) won't pause at all, and a positive number will wait the specified number of seconds. pause 0 is synonymous with print.

If the current terminal supports mousing, then pause mouse will terminate on either a mouse click or on ctrl-C. For all other terminals, or if mousing is not active, pause mouse is equivalent to pause -1.

If one or more end conditions are given after pause mouse, then any one of the conditions will terminate the pause. The possible end conditions are keypress, button1, button2, button3, close, and any. If the pause terminates on a keypress, then the ascii value of the key pressed is returned in MOUSE_KEY. The character itself is returned as a one character string in MOUSE_CHAR. Hotkeys (bind command) are disabled if keypress is one of the end conditions. Zooming is disabled if button3 is one of the end conditions.

In all cases the coordinates of the mouse are returned in variables MOUSE_X, MOUSE_Y, MOUSE_X2, MOUSE_Y2. See mouse variables.

Note: Since pause communicates with the operating system rather than the graphics, it may behave differently with different device drivers (depending upon how text and graphics are mixed).

Examples:

pause -1    # Wait until a carriage return is hit
pause 3     # Wait three seconds
pause -1  "Hit return to continue"
pause 10  "Isn't this pretty?  It's a cubic spline."
pause mouse "Click any mouse button on selected data point"
pause mouse keypress "Type a letter from A-F in the active window"
pause mouse button1,keypress
pause mouse any "Any key or button will terminate"

The variant "pause mouse key" will resume after any keypress in the active plot window. If you want to wait for a particular key to be pressed, you can use a loop such as:

print "I will resume after you hit the Tab key in the plot window"
plot <something>
pause mouse key
while (MOUSE_KEY != 9) {
    pause mouse key
}

Pause mouse close

The command pause mouse close is a specific example of pausing to wait for an external event. In this case the program waits for a "close" event from the plot window. Exactly how to generate such an event varies with your desktop environment and configuration, but usually you can close the plot window by clicking on some widget on the window border or by typing a hot-key sequence such as <alt><F4> or <ctrl>q. If you are unsure whether a suitable widget or hot-key is available to the user, you may also want to define a hot-key sequence using gnuplot's own mechanism. See bind.

The command sequence below may be useful when running gnuplot from a script rather than from the command line.

plot <...whatever...>
bind all "alt-End" "exit gnuplot"
pause mouse close

Copyright 1986 - 1993, 1998, 2004 Thomas Williams, Colin Kelley
Distributed under the gnuplot license (rights to distribute modified versions are withheld).