I am trying to create a bar plot using pgfplots
using the following code:
\documentclass[a4paper]{standalone}
\usepackage{pgfplots}
\begin{document}
\pgfplotstableread[row sep=\\, col sep=&]{
KS & SBC & EBIC & EBICFD & AICC & FPE & RNML & RNMLFD & PD1 & PD2 & PD3 & ORCL \\
2 & 0.8 & 0.9 & 0.9 & 0.6 & 0.6 & 0.6 & 0.9 & 1.2 & 1.6 & 0.6 & 0 \\
3 & 1.9 & 1.9 & 2 & 1.4 & 1.1 & 1.6 & 1.9 & 2 & 3.2 & 0.5 & 0.1 \\
15 & 13.5& 13.5 & 13.6 & 11.8 & 12 & 13.5 & 13.6 & 14 & 29.6& 3.9 & 0 \\
}\mydata
\begin{tikzpicture}% coordinates
\begin{axis}[
ybar = 3pt,
bar width = 10pt,
width = \textwidth,
height= .5\textwidth,
legend style={at={(0.01,0.99)}, anchor=north west},
symbolic x coords={2,3,15},
xtick=data,
nodes near coords,
nodes near coords align={vertical},
ymin=0,ymax=31,
xlabel={Average dist. to the true mask},
ylabel={KS index},
]
\addplot table[x=KS,y=SBC]{\mydata};
\addplot table[x=KS,y=EBIC]{\mydata};
\addplot table[x=KS,y=EBICFD]{\mydata};
\addplot table[x=KS,y=AICC]{\mydata};
\addplot table[x=KS,y=FPE]{\mydata};
\addplot table[x=KS,y=RNML]{\mydata};
\addplot table[x=KS,y=RNMLFD]{\mydata};
\addplot table[x=KS,y=PD1]{\mydata};
\addplot table[x=KS,y=PD2]{\mydata};
\addplot table[x=KS,y=PD3]{\mydata};
\addplot table[x=KS,y=ORCL]{\mydata};
\legend{$\mathrm{SBC}$, $\mathrm{EBIC}$, $\mathrm{EBIC}_{FD}$, $\mathrm{AIC}_{C}$, $\mathrm{FPE}$, $\mathrm{RNML}$, $\mathrm{RNML}_{FD}$, $\mathrm{PD}_{1}$, $\mathrm{PD}_{2}$, $\mathrm{PD}_{3}$, $\mathrm{Oracle}$};
\end{axis}
\end{tikzpicture}
\end{document}
However, it gives me the following graph:
Does anyone know how to modify the code in order to get the bar graph re-dimension properly, and the bars not overlapping like this?
Thanks,