pgfplots - barplot with multiple bars on same coordinate, but labelled differently
You can adapt the method from Center nodes near coords in a stacked ybar plot to use nodes near coords
for the labels:
\documentclass[border=5mm]{standalone}
\usepackage{pgfplots}
\begin{document}
\makeatletter
\pgfplotsset{
calculate offset/.code={
\pgfkeys{/pgf/fpu=true,/pgf/fpu/output format=fixed}
\pgfmathsetmacro\testmacro{(\pgfplotspointmeta *10^\pgfplots@data@scale@trafo@EXPONENT@y)*\pgfplots@y@veclength)}
\pgfkeys{/pgf/fpu=false}
},
every node near coord/.style={
/pgfplots/calculate offset,
yshift=-\testmacro
},
}
\pgfplotstableread{
0 35569 8842 134984
1 30428 4689 34077
2 32920 6207 73787
3 16462 7562 23496
4 12315 8572 16565
5 76572 19572 26030
}\dataset
\begin{tikzpicture}
\begin{axis}[ybar,
width=15cm,
height=8cm,
ymin=0,
ymax=150000,
ylabel={Y-Label},
xtick=data,
xticklabels = {
Category 1,
Category 2,
Category 3,
Category 4,
Category 5,
Category 6
},
xticklabel style={yshift=-8ex},
major x tick style = {opacity=0},
minor x tick num = 1,
minor tick length=2ex,
every node near coord/.append style={
anchor=east,
rotate=90
}
]
\addplot[draw=black,fill=black!20, nodes near coords=Data 1] table[x index=0,y index=1] \dataset; %Data1
\addplot[draw=black,fill=black!40, nodes near coords=Data 2] table[x index=0,y index=2] \dataset; %Data2
\addplot[draw=black,fill=black!60, nodes near coords=Data 3] table[x index=0,y index=3] \dataset; %Data3
\end{axis}
\end{tikzpicture}
\end{document}