0

I would like to delete the labels of all the values, which are smaller than 1000, because they can't be seen correctly.

I searched for a long time and I think there were some similar questions, but unfortunately my coding skills are not the best and that's why it wasn't really working for me. I hope someone can help me. Thanks in advance!

Here is my code:

\begin{tikzpicture}
\begin{axis}[  
compat=newest,   
ybar stacked,     
bar width=40pt,     
%     
nodes near coords,
every node near coord/.style={/pgf/number format/fixed,font=\tiny},
point meta=rawy,    
legend style={at={(0.5,-0.15)},       
anchor=north,legend columns=-1},
%     
axis x line=bottom,     
axis y line=left,
ymajorgrids=true,     
grid style=dashed,
%     
ylabel=Anzahl,     
ymin=0,     
scaled ticks=false,
tick label style={/pgf/number format/fixed},
enlargelimits=auto, 
enlarge x limits=0.3,   
%          
symbolic x coords ={<1980,1980 - 2021,2021},     
xtick=data,  
/pgf/number format/.cd,        
use comma,         
1000 sep={.}
]
\addplot[fill=Blau] coordinates {
(<1980,8653)       
(1980 - 2021,17786)
(2021,26439)  
};   
\addplot[fill=BlauHell] coordinates {
(<1980,501)       
(1980 - 2021,2622)
(2021,3123)       
};  
\addplot[fill=BlauMittel] coordinates {
(<1980,271)       
(1980 - 2021,2601)
(2021,2872)      
};  
\addplot[fill=HellGrau] coordinates {
(<1980,503)       
(1980 - 2021,3694)
(2021,4198)      
};  
\addplot[fill=Gruen] plot coordinates {
(<1980,488)       
(1980 - 2021,2474)
(2021,2961)     
};  
\legend{R1,R2, R3, R4, R5}
\end{axis}  
\end{tikzpicture} 
Torbjørn T.
  • 206,688
  • 1
    Welcome to TeX.SX! Please make your code compilable (if possible), or at least complete it with \documentclass{...}, the required \usepackage's, \begin{document}, and \end{document}. That may seem tedious to you, but think of the extra work it represents for TeX.SX users willing to give you a hand. Help them help you: remove that one hurdle between you and a solution to your problem. – hpekristiansen Dec 03 '21 at 16:44
  • oh my bad, sorry! Next time I will :) – Hello3456 Dec 05 '21 at 08:49
  • For anyone interested I solved it like that:

    every node near coord/.style={
    check for zero/.code={
    \pgfkeys{/pgf/fpu=true}
    \pgfmathparse{\pgfplotspointmeta-1000}
    \pgfmathfloatifflags{\pgfmathresult}{-}{
    \pgfkeys{/tikz/coordinate}
    }{}
    \pgfkeys{/pgf/fpu=false}
    }, check for zero, font=\tiny},
    nodes near coords={\pgfmathprintnumber[fixed zerofill,precision=0]{\pgfplotspointmeta}},

    – Hello3456 Dec 05 '21 at 08:49

0 Answers0