Best way to draw a bar chart in LaTeX? [closed]

Package: bchart

  • Manual

Example code:

\documentclass[varwidth=true, border=2pt]{standalone}

\usepackage{bchart}

\begin{document}
    \begin{bchart}[step=2,max=10]
        \bcbar{3.4}
            \smallskip
        \bcbar{5.6}
            \medskip
        \bcbar{7.2}
            \bigskip
        \bcbar{9.9}
    \end{bchart}
\end{document}

Result:

bchart example

Package: pgfplots

  • Manual: Page 81 – 89

Example code:

% Source: https://tex.stackexchange.com/a/8584/5645
\documentclass[varwidth=true, border=2pt]{standalone}

\usepackage{pgfplots}

\begin{document}
    \begin{tikzpicture}
        \begin{axis}[
            symbolic x coords={a small bar, a medium bar, a large bar},
            xtick=data
          ]
            \addplot[ybar,fill=blue] coordinates {
                (a small bar,   42)
                (a medium bar,  50)
                (a large bar,   80)
            };
        \end{axis}
    \end{tikzpicture}
\end{document}

Result:

pgfplots

I plan to add some more examples to my GitHub repository. You might also be interested in tex.stackexchange.com tag:bar-chart.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)