2
votes

I am making a video for my simulation, where each each frame is a picture of the simulation, and a graph. I'm making the graph with gnuplot, and I first run the simulation to determine the x and y ranges to use and then hardcode the range into the plot script. It works okay, but the plot does not use up the entire surface, there is a ton of white space, and the plot is only about 1/4 of the total area. Is there a way to make the plot expand closer to the edges of the boundary, or a way to control the plot placement?

Script:

set term postscript eps color enhanced "Helvetica" 36
set output 'image.eps'
set size ratio 0.8
set logscale x
set xlabel 'Time(Arb. Units)'
set xrange [10:100000]
set yrange [0:1.6]
set y2range [0:0.5]
set ylabel 'Absorption(%)'
set y2label 'Emission'
set format x '%.0e'
set xtics 10, 100, 100000
set key noautotitles
plot 'absorption.dat' axes x1y1 w lines lt 3 lw 5, 'emission.dat' axes x1y2 w lines lt 1 lw 5

Here is what comes out: enter image description here

I set a grey background so you can see what space is being wasted.

Edit: I've also tried the png terminal, but that seems to make the problem even worse. The plot is shrunk even further. I replaced the top two lines of the script with:

set term png font Helvetica 36
set output 'image.png'

Then this is what comes out: enter image description here

2
in png you're probably using a too big font or too small size of the png image. Type help png to get all options - bibi
I would also suggest to issu the command set ytics nomirror to avoid spurious tics on the y2 axe - bibi
by default png size is 640x480, I usually use set term png enhanced transparent crop size 1200,900 - bibi

2 Answers

2
votes

There are several things involved in the computation of the plot size:

  1. Different terminals have different default canvas sizes. If the defaults don't fit your needs, change the size set terminal ... size ...

  2. The canvas has a fixed aspect ratio (given by the terminals size settings) and you impose an additional constraint with set size ratio... which affects only the plot but not the canvas size. So, if you need this size ratio you must adapt the plot canvas to it.

  3. A third parameter are the margins. Since gnuplot don't exactly know how the labels will be rendered by the terminal, the margins cannot be exact. You can set margins manually with set bmargin ... (for the bottom margin) and equivalently for the other margins.

1
votes

I would suggest to use a terminal that accept the crop flag e.g. png, gif, jpeg but also epscairo