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:

  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)};

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