I'm looking for a package in which you can create nice bar and/or line charts in LaTeX. Currently I'm plotting the charts in Calc (OpenOffice), export it to a PDF document, crop it and then including it as graphics.

I reckon there should be some more efficient way of doing this, preferably entirely in LaTeX.


5 Answers 5


You can take a look at PGF/TikZ, then on top of that is pgfplots. To see it in action, see TeXample.net.

  • pgfplots certianly is a good choice when it comes to bar charts. also the mailing list is very active and there is constant development going on
    – Martin H
    Jan 18, 2011 at 14:12

with PSTricks you can have also 3D charts with hidden surfaces


To keep in line with previous answers, you can look at Metapost or Asymptote, though I guess it might be easier to use a combination of R and Sweave for that particular purpose, especially if you want to load your data from an external file (but see related questions tagged sweave).

  • +1 for Sweave. If you are independently using R for your statistics, then it makes sense to be using it for charts in your documents. There's also the great TikZDevice package for R. (r-forge.r-project.org/R/?group_id=440)
    – Alan Munn
    Jan 18, 2011 at 16:08
  • @Alan Thank you. I forgot about this package.
    – chl
    Jan 18, 2011 at 16:31

I can't seem to be able to correctly format multiline code in a comment, thus I'm adding another answer voting for PGF/TikZ, it's great!

Here's an (slightly adapted :) example of a plot I recently made with pgfplots.

            ylabel={Some Label [\%]},
            bar width=62pt,
            legend style={at={(0.05,0.62)},anchor=north west}
        \addplot coordinates {(0,13)};
        \addplot coordinates {(0,42)};
        \legend{First Thing,Second Thing}
  • it is giving me this error - ! Undefined control sequence. \pr@ship@end ...n@ii =\dimen@ \global \pdfvorigin \dimen@ \dimen@ \dp \pr@bo... l.20 \end{preview} not sure what am i doing wrong
    – Aku
    Jan 20, 2011 at 15:47
  • It does run for me with pdfLaTeX, both on Windows and Mac... You can maybe try to remove the \usepackage[pdftex,active,tightpage]{preview} as well as both the \begin{preview} and \end{preview} as this only produces a cropped pdf...
    – Habi
    Jan 24, 2011 at 16:53

I would use pgf/TikZ too, just like other users who answered.

There are some really old packages bar, barkom. An newer one, worth a try, is bardiag, based on PSTricks.

A PSTricks package for this purpose is pst-bar.

You must log in to answer this question.

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