I have to incorporate a number of line plots in a Latex document and I want to get a very high quality.

Are there any website that show some templates or default plots styles that I can use. Myself I am not good in designing this kind of plot style, so I am searching some good basic settings for the tool I want to use.

About the tools, I think I would like to use Tikz or gnuplot as I want to build tex document and plots in a single run. My data is anyway stored in text files.


2 Answers 2


See this related question. All the same advice applies in your case. Just to highlight a few points:

  1. Using R is a good way to go, especially with the ggplot2 package. This is both flexible and produces very high quality output. There are plenty of examples on the ggplot2 website and across the web (including on this website).
  2. To improve the quality of your plots, you should consider using a different device driver than the default, and choose a high-quality output (e.g. SVG). The Cairo package is one good option. You simply call your plot function before plotting and it redirects to Cairo as the output device. Cairo can be used with any plotting software, not just with R.
  3. In terms of putting your plots together in a LaTeX publication, that's the role that Sweave plays. It makes combining plots with your paper a trivial operation (and has the added benefit of leaving you with something that is reproducible and understandable). Use cacheSweave if you have long-running computations.

If you want more specific help on a particular plot, I advise giving more detail.


If you want a specific example, it is best that you provide more specfics. For more examples of using ggplot, you can also refer to the LearnR blog. Here's an example combining ggplot with Cario for high quality output.

CairoPDF("plot.pdf", 6, 6, bg="transparent")
qplot(factor(cyl), wt, geom=c("boxplot", "jitter"), color=am, data=mtcars)

You can look at the documentation for these packages by using the R help functions.

  • $\begingroup$ Ouaouh! You're just summarizing in a few words a lot of R good practices! $\endgroup$
    – chl
    Sep 29, 2010 at 13:49
  • $\begingroup$ This is not completely what I was looking for but thanks! The command in point 2 is very useful, only why use a bitmap format (png) when the result is pdf? Isn't it way better to have svg, pdf or pgf output? $\endgroup$
    – Peter Smit
    Sep 29, 2010 at 15:03
  • $\begingroup$ @Peter See my updated response. $\endgroup$
    – Shane
    Sep 29, 2010 at 15:24

You are probably aware of TeXexample.net. The TeX package pgfplots might also be of interest to you: it provides a pretty complete manual and allows to directly invoke gnuplot.

Personally, I use Sweave to embed R code, plots and table (see package xtable) into Latex documents. It is very handy especially if you need to run additional processing or statistical tests on your input data. There are many resources about R and its plotting capabilities: R Graph gallery, ggplot2 website and book, R Graphics and Lattice books, as well as many other general tutorials on R that demonstrate how to plot your data.

  • $\begingroup$ Yes, I am aware of TeXexample.net. Besides showing all fancy features, I'm a bit disappointed in the number of 'normal' line plots they have (showing different styles) $\endgroup$
    – Peter Smit
    Sep 29, 2010 at 15:02
  • $\begingroup$ Nice that you cited TeXexample.net! Maybe too much for that purpose, anyway tikz is very powerful for illustrations and diagram. $\endgroup$
    – chl
    Sep 29, 2010 at 20:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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