[texhax] Drawing colored pie chart in KOMA-Class scrreprt (preferably without manually installing pgf-pie

Herbert Voss Herbert.Voss at FU-Berlin.DE
Sun Mar 23 08:24:29 CET 2014


Am 23.03.2014 00:22, schrieb Suresh Govindachar:
>
>> On Fri, Mar 21, 2014 at 5:02 PM, Pascal <pascal.bernhard at belug.de> asked:
>
> [for a simple, quick way to add a 2-dimensional pie chart with colors
> without having to install pgf-pie]:
>
>    > The first example works
>    > (http://www.texample.net/tikz/examples/pie-chart/), but I'm
>    > totally at a loss about how get colors into the pie chart.
>    > This basically does the trick, I do not aspire to fancy stuff
>    > like a drawn out slice, but colors I definitively would like
>    > to see.
>    [...]
>    > I should mention that in my case the pie chart is supposed to
>    > show that the markets is carved up by two companies, one
>    > having a 69 % market share, the other 29 %, which leaves 2 %
>    > for various other tiny firms.  I'm not sure whether I could
>    > modify the example above quite easily to fit my needs, so any
>    > help here would also be higly appreciated.
>
> Here's a simple tweak to that example to get colors and to illustrate
> your particular "69-29-2" example:

Run this PSTricks example with `xelatex`

\documentclass{scrartcl}
\usepackage{pstricks-add}

\begin{document}

  \psset{unit=1.5}
  \begin{pspicture}(-3,-3)(3,3)
  \psChart[userColor={red!30,green!30,blue!40,gray,cyan!50, 
magenta!60,cyan},
 
chartSep=30pt,shadow=true,shadowsize=5pt]{34.5,17.2,20.7,15.5,5.2,6.9}{6}{2}
  \psset{nodesepA=5pt,nodesepB=-10pt}
  \ncline{psChartO1}{psChart1}\nput{0}{psChartO1}{1000 (34.5\%)}
  \ncline{psChartO2}{psChart2}\nput{150}{psChartO2}{500 (17.2\%)}
  \ncline{psChartO3}{psChart3}\nput{-90}{psChartO3}{600 (20.7\%)}
  \ncline{psChartO4}{psChart4}\nput{0}{psChartO4}{450 (15.5\%)}
  \ncline{psChartO5}{psChart5}\nput{0}{psChartO5}{150 (5.2\%)}
  \ncline{psChartO6}{psChart6}\nput{0}{psChartO6}{200 (6.9\%)}
  \bfseries%
  \rput(psChartI1){Taxes}\rput(psChartI2){Rent}\rput(psChartI3){Bills}
  \rput(psChartI4){Car}\rput(psChartI5){Gas}\rput(psChartI6){Food}
  \end{pspicture}

\end{document}




More information about the texhax mailing list