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.

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.

share|improve this question
add comment

5 Answers

up vote 17 down vote accepted

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

share|improve this answer
    
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 '11 at 14:12
add comment

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

share|improve this answer
add comment

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

share|improve this answer
    
+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 '11 at 16:08
    
@Alan Thank you. I forgot about this package. –  chl Jan 18 '11 at 16:31
add comment

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.

\documentclass{article}
\usepackage{pgfplots}
\usepackage[pdftex,active,tightpage]{preview}
\begin{document}
\begin{preview}
    \begin{tikzpicture}
        \begin{axis}[
            ylabel={Some Label [\%]},
            ybar,
            bar width=62pt,
            xtick=data,
            xticklabel={Something},
            legend style={at={(0.05,0.62)},anchor=north west}
            ]       
        \addplot coordinates {(0,13)};
        \addplot coordinates {(0,42)};
        \legend{First Thing,Second Thing}
        \end{axis}
    \end{tikzpicture}
\end{preview}
\end{document}
share|improve this answer
    
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 '11 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 '11 at 16:53
add comment

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.

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.