# Adding extra ticks based on sum of ybar stacked

I am trying to add minor yticks on my axis based on the end values of a ybar stacked plot. Here is where I'm at:

\documentclass[tikz]{standalone}
\usepackage{pgfplotstable}
Year    Far           Near      Sd
2012    1.7786e+01    31.762    88
2013    6.2690e+01    153.828   48
2014    2.9644e+01    25.0714   13
}\datatableD
\begin{document}
\begin{tikzpicture}
\begin{axis}[
ymin=0,
enlarge x limits=0.15,
enlarge y limits={upper, value=0.15},
ybar stacked, bar width=1.5em,
point meta=explicit,
xtick=data,
every node near coord/.style={
yshift=6pt
},
nodes near coords align=center,
yticklabel style={xshift=-10pt},
minor ytick=data,
grid = minor
]
\addplot[nodes near coords*={\footnotesize $(\pgfmathprintnumber\pgfplotspointmeta)$}, white, color=black, draw=none] table [y expr=0, meta=Sd] \datatableD;
\end{axis}
\end{tikzpicture}
\end{document}


Unfortunately, it looks like minor ytick=data returns a list of values from the column Far, but not for the sum Far + Near, any ideas ?

In the MWE, 3 minor ticks are added for y = 17, 29, 62. I would need the minor ticks to be added at y = 17 + 31, 29 + 25, 62 + 153 instead.

-
Would you mind showing a mock-up of your desired final result? Thanks! –  Alenanno Oct 17 '13 at 9:33
I edited the original post, I hope it is more clear now. –  BigDawg Oct 17 '13 at 9:39

By design, minor ytick=data results in tick labels for y coordinates of the first plot (only).
Nevertheless, you need to create the list of required tick labels manually; the magic value data is of no use in this context.
I'll take a note on my todo list for pgfplots to reconsider ytick=data in stacked plots.