Sign up ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I've gone through the answer in Package for pie charts.

Can you please suggest, how to give different color for each pie?

share|improve this question
You might want to have a look here: – d33tah Dec 23 '13 at 19:24

3 Answers 3

up vote 8 down vote accepted

\newcommand{\slice}[5]{ %% use 5 arguments here

  % slice %% I changed !10 to !30 to get darker color
  % use the fifth argument #5 to pass the color  
  \draw[thick,fill=#5!30] (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};


%% -------------- use the new variable \c to pass the color
\foreach \p/\t/\c in {20/type A/red, 4/type B/blue, 11/type C/red,
                   49/type D/green, 16/other/yellow}
          {\p\%}{\t}{\c}  %% here we use the fifth variable



enter image description here

share|improve this answer
Thank You Sigur for solution. – Pawan Mude Dec 23 '13 at 13:39

Just for fun with PSTricks.




    \pstVerb{/IA \thesum\space def /FA IA #2 add def}%
    \uput{1.5}[!IA FA add 2 div](0,0){\scriptsize #2\%}%
    \uput{3.2}[!IA FA add 2 div](0,0){#3}%

\Item{20}{type A}
\Item[blue]{4}{type B}
\Item{11}{type C}
\Item[green]{49}{type D}

enter image description here

share|improve this answer
My answer for another simpler question can be found here. – kiss my armpit Dec 23 '13 at 20:11
Thanks You SIR. – Pawan Mude Dec 26 '13 at 6:13

with chartColor=color you'll get the predefined colors instead of the user defined.


 \rput(psChartI1){type A}\rput[b](psChartI2){type B}
 \rput[t](psChartI3){type C}
 \rput(psChartI4){type D}\rput(psChartI5){other}

enter image description here

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.