Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GNUPLOT cannot zoom in

I am having an issue where I am unable to zoom in on my GNUPLOT. I created a bash script that records various resource information, and displays this information via the following command.

gnuplot -e persist "set title 'Resource monitor' ; set timefmt '%y/%m/%d-%H:%M:%S' ; set xdata time ; set xlabel 'TIME' ; set ylabel 'PERCENT' set yrange [0:101]" -e "plot '${cpuResFile}' using 1:2 title 'CPU' smooth Bezier, '${memResFile}' using 1:2 title 'MEM' smooth Bezier" &

The graph is viewable and displays my information I want, I just cannot figure out how to allow it to zoom in and out. I read that it has something to do with the X11 window no longer being set or that I need to set it via the command line, I just cannot figure out exactly how to, or if this is even the reason. Hopefully there are a couple GNUPLOT experts that can assist me. :)

Thank you.

like image 513
IT_User Avatar asked Jan 19 '16 00:01

IT_User


2 Answers

Zooming and unzooming isn't possible in interactive windows which are left open with the -persist flag. Those operations would require a redrawing which isn't possible anymore since the main programs has already exited.

Quoting from the persist documentation:

[...] gnuplot will open a display window, draw the plot into it, and then exit, leaving the display window containing the plot on the screen. Depending on the terminal type, some mousing operations may still be possible in the persistent window. However operations like zoom/unzoom that require redrawing the plot are generally not possible because the main program has already exited

like image 91
Christoph Avatar answered Sep 20 '22 11:09

Christoph


You could add pause -1 at the end of the command list:

gnuplot -e "plot sin(x); pause -1" &
like image 20
gdupras Avatar answered Sep 22 '22 11:09

gdupras