# pgfplots: Positioning “node near coord” at the bottom of the bar

I would like to position nodes near coords at the bottom of the corresponding bar, right by the X axis.

Here's what I've got now:

\documentclass{report}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
ybar,
ymin=0, yticklabel style={/pgf/number format/fixed},
symbolic x coords={0,1,2,3}, enlarge x limits=0.15,
every node near coord/.append style={font=\tiny, yshift=-30}]
\addplot+ [nodes near coords, point meta=explicit symbolic]
table[x index=0, y index=1, meta index=3] {
0   0.1872  0.0040  0
1   0.0358  0.0017  22
2   0.0358  0.0017  23
3   0.0358  0.0017  24
};
\end{axis}
\end{tikzpicture}
\end{document}


I assume if I could write something like yshift=\getcurrentvalueofy (or yshift=\getbarheight), the problem would be solved. I tried \pgfkeysvalueof{/data point/y}, but I must admit I did not really understand what I was doing, so it did not work out.

You can make the value of the y coordinate available using the key visualization depends on=y \as \rawy (where \rawy is a macro name you choose). Then you can shift the nodes using shift={(axis direction cs:0,-\rawy)}. Note that you'll have to use axis direction cs because the coordinate system is shifted and scaled at the time when the nodes are placed.

\documentclass{report}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
ybar,
ymin=0, yticklabel style={/pgf/number format/fixed},
visualization depends on=y \as \rawy,
symbolic x coords={0,1,2,3}, enlarge x limits=0.15,
every node near coord/.append style={
font=\tiny,
shift={(axis direction cs:0,-\rawy)}
}
]
\addplot+ [nodes near coords, point meta=explicit symbolic]
table[x index=0, y index=1, meta index=3] {
0   0.1872  0.0040  0
1   0.0358  0.0017  22
2   0.0358  0.0017  23
3   0.0358  0.0017  24
};
\end{axis}
\end{tikzpicture}
\end{document}