Take the 2-minute tour ×
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.

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).

share|improve this question
    
You might be interested in tex.stackexchange.com/questions/31465/… –  Christian Feuersänger Oct 13 '11 at 18:03
    
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 Miklavec Oct 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. –  Bruce Connor Oct 13 '11 at 23:36
add comment

2 Answers

up vote 14 down vote accepted

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.

share|improve this answer
    
super-stupid-tiny detail: predecessor comes before its successor (then what does processor do, I have no idea :P) –  percusse Oct 13 '11 at 17:39
    
Hope you don't mind, Martin; I took the liberty of making the correction... –  Brent.Longborough Oct 13 '11 at 18:01
    
@Brent.Longborough: Thanks, my bad. I already had a glass of wine ;-) –  Martin Scharrer Oct 13 '11 at 18:03
    
@Martin: Nice answer. Good enough to make me adapt my title to it. :-) –  Bruce Connor Oct 13 '11 at 18:37
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

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.