I have a plot obtained with gnuplot with epslatex terminal. So, I have two output files from gnuplot: foo.eps with the graph and foo.tex with the label also. To include the plot in my latex document I have write



\caption{bla bla}


The problem is that the caption apparently see only the .eps and write over the labels contained in the .tex file. How to tell the caption to write at the bottom of the entire plot (image+labels)?

The problem is with all gnuplot+epslatex graphs. I do something like

set term epslatex
set output 'foo.tex'
set xlabel '$x$'
set ylabel '$f\left(x\right)$'
plot 'data.dat' u 1:2 w lines

and the caption is always under the image but overlapped with the x-label. There is a way to move the caption manually even if is not the elegant way?

  • Why don't you use \includegraphics for the eps-file? Jun 29, 2014 at 10:00
  • Because the .eps file doesn't have the labels... This is why gnuplot in epslatex mode gives you two output files: one for the plot and one for the latex labels. Jun 29, 2014 at 10:03
  • Ah ok. I didn't know this, thanks. Jun 29, 2014 at 10:12
  • Can you make the files generated by gnuplot available for download? Alternatively, you could edit your question and add a gnuplot script which creates files that reproduce the problem. Jun 29, 2014 at 10:38
  • 1
    I can't reproduce this: The caption doesn't overlap the axis label for me. What compiler are you using (latex, pdflatex, xelatex)? What version of gnuplot are you using?
    – Jake
    Jun 29, 2014 at 11:02

1 Answer 1


When the epslatex terminal is used, gnuplot produces an eps file and a separate file containing tex code. This tex code includes the image using \includegraphics, and adds labels etc. using the picture environment. If this code is used in a document that is compiled by pdflatex, the eps file will be converted to pdf before inclusion. If gnuplot creates plot.tex and plot.eps, then, after compilation there will also be a file called plot-eps-converted-to.pdf.

Now it's difficult to determine exactly what is happening because I can't reproduce the problem on my machine. However, from the fact that the problem does not occur with latex+dvips, we can deduce that the automatic eps to pdf conversion is not working properly. It's probably worth opening some of the -eps-converted-to.pdf files in a viewer to see if the problem is visible. As a workaround, I suggest removing the -eps-converted-to.pdf files and doing the conversions yourself using eps2pdf so that pdflatex doesn't have to do it.

  • No, the manual conversion of the eps file doesn't work. I can't try the latex+dvips+ps2pdf with my document because of the jpg \includegraphics. I don't think the problem is the conversion, because it goes all right with both methods. And the real problem is not with the images that are nice but with the caption! Jun 29, 2014 at 16:22
  • 1
    @bluePhlavio --- the most likely cause of an image overlapping a caption is a problem with the image itself, but since I can't reproduce the issue my efforts so far have been guesswork. I suggest you compose a short, complete example consisting of the tex file(s), gnuplot script, data file(s) (if needed), the files generated by gnuplot and the -eps-converted-to.pdf' file, and add this to your question. Images can be uploaded to remote hosting sites and linked from here. Jun 30, 2014 at 8:43
  • Sorry, I was wrong. The problem arises only with multiplot mode and with zero bmargin... The reformulated problem is here: stackoverflow.com/questions/24518490/… Jul 1, 2014 at 20:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .