0

I know how to draw for single data...

but How to draw the bars one on the other where the data's grouped

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

\begin{document}
    \begin{tikzpicture}
        \begin{axis}[
            symbolic x coords={2006,2007,2008},
            xtick=data
          ]
            \addplot[ybar,fill=blue] coordinates {
                (2006,   42)
                (2007,  50)
                (2008,   0)
             };
        \end{axis}
    \end{tikzpicture}

\end{document}

My data is like this, Number of students in a year batch wise,

$$\begin{matrix}{cccc}
year  &  batch 1&   batch 2 &    batch 3\\

2006  &   42  &      87   &       8\\

2007   & 50        & 90        & \\

2008    &      &     78  &        90 
\end{matrix}$$

Now I want the data on the respective bars. Like in the following diagram.. It no need to be a 3D diagram.

How to do that??

enter image description here

Zarko
  • 296,517
David
  • 1,964

0 Answers0