Search code examples
plotsizegnuplot

gnuplot, output figure size


I have tried to set output figure size by a term size with png or ps. Neither works. I got random emoticons and signs in the terminal (gnuplot v. 5.2).

my script which I executed in wxt terminal by load scriptname:

reset
set term png size 800,400
set ylabel "name1" 
set xlabel  font ",16"
set ylabel  font ",16"
set xtics font ",16"
set ytics font ",16"
set title "title" offset 0,-3.5
set title font ",16"
set key font ",14"
set xlabel "name 2" 
set ytics (11, 12, 13, 14)
set xtics 0.5
#set nokey
set key left 

Without set term png size 800,400 line (values are for purpose of example), it executes the plot perfectly, if I expand the plot via mouse it works as well but I would like to produce many plots with the same size but bigger than the default. Expanding by mouse every time did not make the same size plot.


Solution

  • There are basically two ways to get a PNG file:

    1. display your graph in a wxt terminal (and optimize it until you like it). And then save it as file (in my case I have the options PNG, PDF, SVG or EMF).

    2. set a PNG terminal and set the output file name. The output will be directly written to the file and not shown in the wxt terminal terminal.

    Output in wxt terminal and manually save as PNG

    reset session
    set term wxt size 1000,500   # or any other size you want
    plot sin(x)
    

    enter image description here

    Direct output to PNG

    reset session
    set term pngcairo size 1000,500   # or any other size you want
    set output "myOutput.png"
    plot sin(x)
    set output