I can't figure out a way to prevent small values showing in my labels. A problem that looked very similar to mine can be found in here. Due to my non-existent coding skills I couldn't figure out this on my own. So here is the code I've got so far:



\definecolor{RYB1}{RGB}{128, 177, 211}
\definecolor{RYB2}{RGB}{251, 128, 114}
\definecolor{RYB3}{RGB}{190, 186, 218}
\definecolor{RYB4}{RGB}{255, 255, 179}
\definecolor{RYB5}{RGB}{141, 211, 199}
\definecolor{RYB6}{RGB}{253, 180, 98}



     /pgf/number format/precision=2, 
    /pgf/number format/fixed zerofill=true,
    /pgf/number format/fixed
ybar stacked,
bar width=9mm,
nodes near coords,
legend style={at={(0.5,-0.20)},
anchor=north,legend columns=-1},
symbolic x coords={A, B, C},
cycle list name=ColorListBar
\addplot plot coordinates {(A,0.26) (B,0.32) (C,0.32)};
\addplot plot coordinates {(A,0.28) (B,0.29) (C,0.35)};
\addplot plot coordinates {(A,0.05) (B,0) (C,0.01)};
\addplot plot coordinates {(A,0.13) (B,0.17) (C,0.17)};
\addplot plot coordinates {(A,0.06) (B,0.01) (C,0.01)};
\addplot plot coordinates {(A,0.05) (B,0.07) (C,0.01)};
\legend{1, 2, 3, 4, 5, 6}

This results in a Figure that looks like this: enter image description here

I would like to remove the labels that currently have the value 0.01 and thus look very cluttered. How could this be achieved?


It's actually the same question indeed but here is your version,

instead of just nodes near coords, you can apply a test as follows

nodes near coords = {%
    \pgfmathprintnumberto[fixed,assume math mode=true]{\pgfplotspointmeta}{\myval}%

enter image description here

  • This was exactly what I was looking for and the reply speed was rather impressive. A big thank you! – Cadbon Aug 12 '14 at 17:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.