I am plotting graphs in gnuplot and would like to open them in full screen and a particular size.
Previously, I have been outputting graphs in multiplot mode and updating them using reread; so, when I maximise it manually, the plots fill the screen after a few iterations. Now, I also want to save the output as a file. When I open that file, it is in the same small size as the original multiplot output. However, when I maximise it, the plots don't increase in size to fill the screen. I have 2 questions:
- How can I open the multiplot file in full screen?
- How can I make the output file a particular size?
Here is my current gnuplot code (in a file called gnuplotCode):
set terminal pngcairo dashed enhanced
set output 'foo.png'
set multiplot layout 3, 3
plot for [iter=1:9] path/to/file using 1:(column(iter)) notitle
unset multiplot
unset output
pause 10
reread
I have tried to type the following:
gnuplot -geometry -3360-1050 gnuplotCode # where my screen size is 3360x1050
and:
resolution=$(xrandr | grep '*') && resolution=${resolution% *}
gnuplot -geometry $resolution gnuplotCode
but neither approach works. Please can you tell me how to open gnuplots in full screen and a particular size? Thank you.
You must distinguish between pixel-based terminals (
pngcairo
,png
,canvas
(...) and all interactive terminalswxt
,x11
,qt
,windows
,aqua
, where the size is given in pixel. For vector-based terminals (postscript
,svg
,postscript
etc) the size is given in inch or centimeters.Using the
-geometry
flag works only for thex11
terminal:For all other pixel-based terminal you can use the
size
option to set the canvas size in pixel:Of course you can also extract the monitor resolution and use that as size. Here you have two variants:
Extract the monitor size on the shell:
The file
gnuplotCode
must then use the gnuplot variablemonitorSize
as follows:Note, that the content of the string variable
monitorSize
must be used as macro, i.e. the value is inserted before the whole line is evaluated.If you don't want to have that additional line on the shell, you could also call the
xrand
stuff from within the gnuplot script via thesystem
function. In that case the filegnuplotCode
would look as follows:which you must call only with
gnuplot gnuplotCode
.Note, that the shell command as is always extracts the information of the first monitor only.