Back in my first courses I learned that the best graphic format to use when plotting data with gnuplot (which will later be used in a LaTeX document) is eps (encapsulated postscript). I didn't really learn why, though.

Lately, I was reading through gnuplot's documentation and I found out it can save plots not only in LaTeX format, but also in emtex, pstex, pslatex and texdraw (besides many others, of course).

My question is: Given that the image's ultimate fate is to be inserted in a latex document, wouldn't one of these formats be more suitable than eps (or the more recent pdf)?

By suitable I mean having more features and better final output (alignment, positioning, fonts, etc).

This is not exactly the right question. LaTeX graphics vs. eps vs. pdf question is almost independent from choice of terminal in gnuplot. I would add "... in gnuplot" to your question.
–
Mojca MiklavecOct 13 '11 at 22:33

@MojcaMiklavec I really just mentioned gnuplot to give contex, I didn't think it was relevant enough to include in the title. The point is to ask which format is most suitable for an image that's to be included inside a LaTeX document. Still, I'm pretty satisfied with Martin's answer, so feel free to edit the question if you see fit.
–
MalabarbaOct 13 '11 at 23:36

2 Answers
2

In the past EPS was a good format to use for plots because it stored vector graphics. It doesn't make sense to save plots as raster images. However, nowadays PDF, which is kind of the successor of PS, is the better format. It also supports vector graphics, font inclusion and also raster images. Because it is binary it normally takes much less space than EPS files. Also PDF is by design easier to display because you don't need a complex language interpreter as for (E)PS.

If you take Gnuplot and select LaTeX output, you will get some LaTeX code, which draws the plot, but this doesn't mean it is the best possible result. Automatically generated LaTeX code (or for any other language) is often very limited. I wasn't happy after testing the LaTeX output of Gnuplot the last time.

I would try to go with PDF output (i.e. pdfcairo with my Gnuplot under Linux) and see if the quality is good. If you use the modern pdflatex you can use these PDF files directly in your document.

Another approach entirely is to draw the plot directly using LaTeX. Both PGF/TikZ and PSTricks allow for generating plots out of data files. Then you can ensure that the used fonts match the one in the rest of the document and can easily use LaTeX symbols in the labels.

In gnuplot the latex terminal is both primitive and ugly. With the exception of (e)ps(la)tex, most terminals (latex, emtex, tpic, texdraw, pstricks, mf, mp) are old, unmaintained and hardly usable, and even epslatex is problematic if you want to use pdfTeX or XeTeX. One of the main problems with gnuplot is that they keep so many outdated terminals that it is a difficult task to figure out which ones are good and which ones are not.

The only TeX-based terminal for Gnuplot worth recommending is the one based on tikz. I also wrote one for context, but that won't help you if you are a LaTeX user.

pdf(cairo) terminal is maintained and does the job as long as you don't need any advanced formulas and "font synchronization". You can still use, say, Latin Modern in PDF output, but that requires slightly more effort than simply including a document generated with tikz terminal. On the other hand TeX will run out of memory with pm3d or other graphically complex examples (pm3d examples generate 10.000 rectangles or more), so pdf might be the only choice. With even more graphical elements (million or more; frequent in scatter plots) even pdf viewer won't be able to display the plot in reasonable time, so you would have to use png.

(e)ps terminal is almost the same as pdf (pdf is only better for new TeX engines and supports transparency).

If (e)ps(la)tex gets replaced with "pdflatex" terminal one day: combining efficient graphics handling with pdf and well integrated text typeset with TeX, that would also work well for most purposes.

However if you take gnuplot out of picture, your original question of whether TeX or pdf is preferred for graphics, you would get a completely different answer.