[Tex/LaTex] Fix group bar chart spacing

bar chartpgfplots

Consider the following MWE

\documentclass[tikz]{standalone}
\usepackage{lmodern}

\usepackage{pgfplots}
\pgfplotsset{compat=newest}
 \usepackage{pgfplotstable}


\begin{document}
\pgfplotstableread[col sep=comma]{
month, 2012, 2013, 2014
January, 112798, 110052, 108772
February, 58183, 63319, 58303
March, 82263, 77653, 51626
April, 60834, 82041, 52901
May, 76389, 92386, 55931
June, 69716, 74734, 51540
July, 74161, 87917, 61273
August, 76480, 82330, 57653
September, 64509, 84757, 58516
October, 70193, 88920,
November, 58096, 61552,
December, 37551, 49362,
}\datatable
\begin{tikzpicture}
\begin{axis}[
    % Bar plot and axis settings
    ybar,
    axis lines*=left,
    ymajorgrids,
    bar width=0.26cm,
    % Y ticks and label
    ymin=0, ymax=150000,
    ytick={0,20000,40000,60000,80000,100000,120000},
    y tick label style={font=\footnotesize},
    ylabel= Unidades,
    % X ticks
    xtick=data,
    x tick label style={font=\footnotesize,align=right,rotate=90},
    every tick/.style={color=black, line width=0.35pt},
    xticklabels from table={\datatable}{month},
    enlarge x limits=0.1,
]
\pgfplotsinvokeforeach {1,...,3}{
    \addplot table [x expr=\coordindex, y index=#1] {\datatable};
}
\end{axis}
\end{tikzpicture}
\end{document}

This generates the following image:

enter image description here

As it can be seen in the image, the bars for each group (month) overlap. I tried playing with enlarge x limits but cannot make it work. How can I fix it?

Best Answer

Turn my comments with OP into an answer so that the question won't be unanswered.

enter image description here

Code

\documentclass[tikz,border=10pt]{standalone}
\usepackage{lmodern}

\usepackage{pgfplots}
\pgfplotsset{compat=newest}
 \usepackage{pgfplotstable}


\begin{document}
\pgfplotstableread[col sep=comma]{
month, 2012, 2013, 2014
January, 112798, 110052, 108772
February, 58183, 63319, 58303
March, 82263, 77653, 51626
April, 60834, 82041, 52901
May, 76389, 92386, 55931
June, 69716, 74734, 51540
July, 74161, 87917, 61273
August, 76480, 82330, 57653
September, 64509, 84757, 58516
October, 70193, 88920,
November, 58096, 61552,
December, 37551, 49362,
}\datatable
\begin{tikzpicture}
\begin{axis}[
    % Bar plot and axis settings
    ybar,
    axis lines*=left,%scaled y ticks=false,
    ymajorgrids,
    bar width=0.26cm, width=1.45\textwidth,
    % Y ticks and label
    ymin=0, ymax=150000,
    ytick={0,20000,40000,60000,80000,100000,120000},
    y tick label style={font=\footnotesize},
    ylabel= Unidades,
    % X ticks
    xtick=data,
    x tick label style={font=\footnotesize,align=right,rotate=90},
    every tick/.style={color=black, line width=0.35pt},
    xticklabels from table={\datatable}{month},
    enlarge x limits=0.1,
]
\pgfplotsinvokeforeach {1,...,3}{
    \addplot table [x expr=\coordindex, y index=#1] {\datatable};
}
\end{axis}
\end{tikzpicture}
\end{document}