0

I am trying to generate an easy bar chart with 4 bars in pgfplots. I don't know why, but the x coordiantes are now twice on the x axis without an actual value.

enter image description here

What I wanted to have was only 4 bars with the shown values, but with the labels only once.

Here is my code:

\begin{tikzpicture}   
\begin{axis}[     
ybar,     
bar width=20pt,     
%     
nodes near coords,     
nodes near coords align=above,     
point meta=rawy,     
%     
axis x line=bottom,     
axis y line=left,     
ymajorgrids=true,     
%     
ylabel=$\mathrm{t\,CO_2/a}$,     
ymin=0,     
ytick={0,20,40,60,80,100,120},    
enlargelimits=auto,     
%          
symbolic x coords ={Anlage1,Anlage2,Anlage3,Anlage4},     
x tick label style={rotate=30,anchor=north east},     
]
\addplot[fill=myblue] coordinates {       
(Anlage1,20.0)       
(Anlage2,7.0)           
(Anlage3,79.0)       
(Anlage4,33.0)     
};   
\end{axis}  
\end{tikzpicture}

Thanks in advance!

Stefan Pinnow
  • 29,535

0 Answers0