One can easily create "groups" of bar plots using the ybar/xbar attribute for the axis environment. When multiple \addplot commands are issued using the same x/y coordinate, the entire group of bar plots for one coordinate is then centered on that coordinate. However, this seems to require that the same number of bar plots is used in every group. Is there any way to relax this condition?
Modified example from the pgfplots documentation:
\documentclass{standalone}
\usepackage{tikz}
\usepackage{pgfplots}
\usepackage{pgfplotstable}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
width=0.95*\textwidth,
x tick label style={/pgf/number format/1000 sep=},
ylabel=Population,
enlargelimits=0.15,
legend style={at={(0.5,-0.15)},
anchor=north,legend columns=-1},
ybar,
bar width=7pt,
]
\addplot
coordinates {(1930,50e6) (1940,33e6) (1950,40e6) (1960,50e6) (1970,70e6)};
\addplot
coordinates {(1930,38e6) (1950,43e6) (1960,45e6) (1970,65e6)};
\addplot
coordinates {(1930,15e6) (1940,12e6) (1950,13e6) (1970,35e6)};
\legend{Far,Near,Here,Annot}
\end{axis}
\end{tikzpicture}
\end{document}
The numbers that were left out appear as gaps within the groups of bar plots. Is there any way to change that behaviour?


\addplots works. – Peter Grill Feb 08 '12 at 15:32