2013-03-03 16:01:14 +01:00

35 lines
1.0 KiB
TeX

Figure \ref{fig:co2_wind} shows a pie chart.
\newcommand{\slice}[4]{
\pgfmathparse{0.5*#1+0.5*#2}
\let\midangle\pgfmathresult
% slice
\draw[thick] (0,0) -- (#1:1) arc (#1:#2:1) -- cycle;
% outer label
\node[label=\midangle:#4] at (\midangle:1) {};
% inner label
\pgfmathparse{min((#2-#1-10)/110*(-0.3),0)}
\let\temp\pgfmathresult
\pgfmathparse{max(\temp,-0.5) + 0.8}
\let\innerpos\pgfmathresult
\node at (\midangle:\innerpos) {#3};
}
\begin{figure}[htb]
\centering
\begin{tikzpicture}[scale=3]
\newcounter{a}
\newcounter{b}
\foreach \p/\t in {5/Shot break, 19/Rotor, 7/Gear + Generator, 18/remaining Housing, 20/Tower, 6/Power connection, 8/Basement, 3/Misc, 14/Operation}
{
\setcounter{a}{\value{b}}
\addtocounter{b}{\p}
\slice{\thea/100*360}
{\theb/100*360}
{\p\%}{\t}
}
\end{tikzpicture}
\caption[Break down of the CO$_2$ emissions of a wind turbine]{Break down of the CO$_2$ emissions of a wind turbine \cite{kaltschmitt2006}}
\label{fig:co2_wind}
\end{figure}