von sashavaia » Fr 3. Jul 2015, 17:59
Hallo zusammen,
ich wuerde gerne ein Säulendiagramm erstellen.
Ich habe den unten stehenden Code benutzt:
\begin{figure}[h]
\centering
\begin{tikzpicture}
\begin{axis}[
axis lines=left,
ybar stacked,
enlargelimits=0.1,
nodes near coords,
%nodes near coords align={horizontal},
legend style={at={(1.4,-0.50)},
anchor=north,legend columns=-1},
ylabel={GW},
symbolic x coords={Cina, USA, Brasile, Germania,
Canada, Giappone, India, Italia, Russia, Spagna},
xtick=data,
x tick label style={rotate=48,anchor=east},
width=13cm,
height=8cm,
legend style={cells={anchor=west},legend pos=north east}
]
\node[coordinate,pin=right :{454.8}] at (axis cs:Cina,454.8) {};
\node[coordinate,pin=above :{203.5}] at (axis cs:USA,203.5) {};
\node[coordinate,pin=above :{107.5}] at (axis cs:Brasile,107.5) {};
\node[coordinate,pin=above :{97.4}] at (axis cs:Germania,97.4) {};
\node[coordinate,pin=above :{89.5}] at (axis cs:Canada,89.5) {};
\node[coordinate,pin=above :{79.6}] at (axis cs:Giappone,79.6) {};
\node[coordinate,pin=above :{75.3}] at (axis cs:India,75.3) {};
\node[coordinate,pin=above :{54.0}] at (axis cs:Italia,54.0) {};
\node[coordinate,pin=above :{51.3}] at (axis cs:Russia,51.3) {};
\node[coordinate,pin=above :{50.2}] at (axis cs:Spagna,50.2) {};
\addplot+[ybar] plot coordinates {(Cina,454.8) (USA,203.5)
(Brasile,107.5) (Germania,97.4) (Canada,89.5) (Giappone,79.6) (India,75.3) (Italia,54.0) (Russia,51.3) (Spagna,50.2)};
\legend{cumulato}
\end{axis}
\end{tikzpicture}
\caption{Top 10 Paesi nel 2014 per capacità cumulata}
\label{fig: capacità2014}
\end{figure}
Mein Problem ist, dass ich gerne bei jede Säule eine andere Farbe anzeigen lassen will, aber hier die gleiche Farbe haben.
Hat jemand einen Loesungsvorschlag?
Vielen Dank.[/code]
Hallo zusammen,
ich wuerde gerne ein Säulendiagramm erstellen.
Ich habe den unten stehenden Code benutzt:
[code]\begin{figure}[h]
\centering
\begin{tikzpicture}
\begin{axis}[
axis lines=left,
ybar stacked,
enlargelimits=0.1,
nodes near coords,
%nodes near coords align={horizontal},
legend style={at={(1.4,-0.50)},
anchor=north,legend columns=-1},
ylabel={GW},
symbolic x coords={Cina, USA, Brasile, Germania,
Canada, Giappone, India, Italia, Russia, Spagna},
xtick=data,
x tick label style={rotate=48,anchor=east},
width=13cm,
height=8cm,
legend style={cells={anchor=west},legend pos=north east}
]
\node[coordinate,pin=right :{454.8}] at (axis cs:Cina,454.8) {};
\node[coordinate,pin=above :{203.5}] at (axis cs:USA,203.5) {};
\node[coordinate,pin=above :{107.5}] at (axis cs:Brasile,107.5) {};
\node[coordinate,pin=above :{97.4}] at (axis cs:Germania,97.4) {};
\node[coordinate,pin=above :{89.5}] at (axis cs:Canada,89.5) {};
\node[coordinate,pin=above :{79.6}] at (axis cs:Giappone,79.6) {};
\node[coordinate,pin=above :{75.3}] at (axis cs:India,75.3) {};
\node[coordinate,pin=above :{54.0}] at (axis cs:Italia,54.0) {};
\node[coordinate,pin=above :{51.3}] at (axis cs:Russia,51.3) {};
\node[coordinate,pin=above :{50.2}] at (axis cs:Spagna,50.2) {};
\addplot+[ybar] plot coordinates {(Cina,454.8) (USA,203.5)
(Brasile,107.5) (Germania,97.4) (Canada,89.5) (Giappone,79.6) (India,75.3) (Italia,54.0) (Russia,51.3) (Spagna,50.2)};
\legend{cumulato}
\end{axis}
\end{tikzpicture}
\caption{Top 10 Paesi nel 2014 per capacità cumulata}
\label{fig: capacità2014}
\end{figure}
[/code]
Mein Problem ist, dass ich gerne bei jede Säule eine andere Farbe anzeigen lassen will, aber hier die gleiche Farbe haben.
Hat jemand einen Loesungsvorschlag?
Vielen Dank.[/code]