3

When creating stacked bar charts with pgfplots, how can I avoid printing those (and only those) "nodes near coords" if there is too little space? The following MWE illustrates the problem:

\documentclass{standalone}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{width=7cm,compat=1.12}
\begin{document}
\begin{tikzpicture} 
\begin{axis}[
  ybar stacked,ylabel={participants},
  symbolic x coords={tool1, tool2},
  xtick=data,x tick label style={rotate=45,anchor=east},
  nodes near coords,clip mode=individual]
\addplot+[ybar] plot coordinates {(tool1,1) (tool2,4)};
\addplot+[ybar] plot coordinates {(tool1,5) (tool2,0.2)};
\legend{never,rarely}
\end{axis}
\end{tikzpicture}
\end{document}

There is too little space for the node "0.2", so how could I avoid printing it, but keeping all the others?

  • 2
    Too little space is not well-defined. If you increase the height then they fit or you change the scale then they don't fit etc. So instead of checking a lot of details, just filter them tex.stackexchange.com/questions/196022/… – percusse Mar 16 '15 at 17:16
  • You are right that "too little space" is not well defined. However, I don't have the luxury of increasing the height because of a limit on the number of pages. In any case, your pointer to the previous question solved my problem. Thanks. – user1362373 Mar 16 '15 at 19:16
  • I made a mistake with closing sorry it should be ok now. – percusse Mar 16 '15 at 22:45