TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm uploading an image I created with gnuplot on to my document using;

\caption{Graph caption}

The problem is it looks like;


The figure caption is way too low. I can't figure out whether this is an issue with LaTeX or gnuplot. I've tried to figure out ways to reduce the margin on gnuplot but to no avail.

How do I decrease the gap from the picture and caption?

If anyone needs, this is my gnuplot stuff;

 set terminal latex
 set out 'plot.tex'
 set termoption dash

 set xrange [0:20]
 set yrange [-1:1]

 unset colorbox

 plot besj1(x)  ls 1 title '$J_1(x)$',\
 besy1(x)  ls 11 title '$Y_1(x)$',  \

set label 5 '$J_1(x)$' at 2, 0.7
set label 6 '$Y_1(x)$' at 4.5, 0.45
set size 1, 0.75

unset key
set out
share|improve this question
Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – Christian Hupfer May 9 '14 at 4:36
It looks like a suboptimal bounding box for your figure but without a minimal working example, it's difficult to tell. – Svend Tveskæg May 9 '14 at 4:36
Why do you not use eps or pdf terminal for graphics output of gnuplot? – Christian Hupfer May 9 '14 at 4:37

It looks like gnuplot's latex terminal introduces some empty space around the plot. You can see it with

\caption{Graph caption}

which produces

enter image description here

I don't know how to suppress this margin within gnuplot (long time without using it ;-)) but you can adjust it from plot.tex.

This file starts with

% GNUPLOT: LaTeX picture

(1500,900) is figure's top right corner and (0,0) its bottom left corner. Change (0,0) to (0,40), save plot.tex, compile again and will get:

enter image description here

If you have to do a lot of figures like this, I'd suggest selecting another terminal (eps, pdf, tikz) or using pgfplots which can call gnuplot to compute Bessel functions.

share|improve this answer

An alternative is to plot it via pgfplots with addplot and gunplot capability. Then use of caption to adjust the gap between the figure and the caption.

enter image description here




solid, line width=1.0pt,
domain=0:20, samples=400]
gnuplot {besj1(x)};
\node at (axis cs: 6,0.5){$Y_1(x)$};
solid, line width=1.0pt, restrict y to domain=-1:1,
gnuplot {besy1(x)};
\node at (axis cs: 2,0.7){$J_1(x)$};
\caption{Graph caption}

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.