plot 'something' pause mouse if (exists("MOUSE_BUTTON")) call 'something_else'; \ else print "No mouse click."
It is also possible to track keystrokes in the plot window using the mousing code.
plot 'something' pause mouse keypress print "Keystroke ", MOUSE_KEY, " at ", MOUSE_X, " ", MOUSE_Y
When pause mouse keypress is terminated by a keypress, then MOUSE_KEY will contain the ascii character value of the key that was pressed. MOUSE_CHAR will contain the character itself as a string variable. If the pause command is terminated abnormally (e.g. by ctrl-C or by externally closing the plot window) then MOUSE_KEY will equal -1.
Note that after a zoom by mouse, you can read the new ranges as GPVAL_X_MIN,
GPVAL_X_MAX, GPVAL_Y_MIN, and GPVAL_Y_MAX, see gnuplot-defined variables (p. ).