I need to group the labels in the x axis by putting a second level label. I need to separate the nodes that are grouped from the other ones or marked them somehow.
For example, if I have the labels in the example below I would like to have
S1 S2 S3 S4 S5 S6 S7 S8 S9 S10
X Group Y Group Z Group
How can I achieve this? I check the manual of pgfplots without any hint. Is there a special name for what I'm trying to achieve?
\documentclass{standalone}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotstableread{
1 19.178 26.027 8.219 6.849 39.726
2 54.795 21.918 4.110 6.849 12.329
3 28.767 16.438 6.849 8.219 39.726
4 63.014 2.740 2.740 2.740 28.767
5 90.411 1.370 6.849 0.000 1.370
6 15.068 2.740 16.438 8.219 57.534
7 67.123 0.000 0.000 0.000 32.877
8 72.603 6.849 5.479 0.000 15.068
9 56.164 12.329 6.849 4.110 20.548
10 50.685 4.110 8.219 1.370 35.616
}\datatable
\begin{document}
\makeatletter
\begin{tikzpicture}
\begin{axis}[
ylabel=label,
xtick=data,
xticklabels={S1,S2,S3,S4,S5,S6,S7,S8,S9,S10},
enlarge y limits=false,
enlarge x limits=0.1,
ymin=0,ymax=100,
ybar stacked,
bar width=10pt,
legend style={
font=\footnotesize,
cells={anchor=west},
legend columns=5,
at={(0.5,-0.15)},
anchor=north,
/tikz/every even column/.append style={column sep=0.2cm}
},
]
\addplot table[x index=0,y index=1] \datatable;
\addplot table[x index=0,y index=2] \datatable;
\addplot table[x index=0,y index=3] \datatable;
\addplot table[x index=0,y index=4] \datatable;
\addplot table[x index=0,y index=5] \datatable;
\legend{Far,Near,Here,There,NotThere}
\end{axis}
\end{tikzpicture}
\end{document}
