Pie charts with LaTeX TikZ

Define a new command to insert a pie slice:


  % slice
  \draw[thick,fill=black!10] (0,0) -- (#1:1) arc (#1:#2:1) -- cycle;

  % outer label
  \node[label=\midangle:#4] at (\midangle:1) {};

  % inner label
  \pgfmathparse{max(\temp,-0.5) + 0.8}
  \node at (\midangle:\innerpos) {#3};

Then define the slices in the order you want to have them and with the percentages and labels. You can start at a different point in the circle by setting the counter ‘d’ to a different value before the loop, e.g. \setcounter{d}{25}.

\foreach \p/\t in {66/, 17/Equative, 10/Difference, 7/}
          { \small \p\%}{\t}
  \node[label=0.5:Ranked] at (1,0.6) {};
  \node[label=0.5:Superlative] at (1,-0.3) {};

I didn’t like the automatic placement of two labels, that is why I gave ‘Ranked’ and ‘Superlative’ an empty label in the loop and placed them by hand later on.

The original is from Texample, uploaded by Robert Vollmert.