[texhax] Drawing colored pie chart in KOMA-Class scrreprt (preferably without manually installing pgf-pie
Pascal
pascal.bernhard at belug.de
Sun Mar 23 13:41:13 CET 2014
Am Saturday, den 22.03.2014, 19:08 -0500 schrieb Herbert Schulz:
> On Mar 21, 2014, at 4:02 AM, Pascal <pascal.bernhard at belug.de> wrote:
>
> > Hi all,
> >
> > I would like to insert a colored pie chart into my master's thesis I
> > write with LaTeX using the KOMA-class sccreprt.
> >
> > The purpose is to show the market share of different companies. This as
> > a disclaimer, since I have read several times on the web, that it is
> > advised against using pie charts. Still I find this the most
> > illustrative way to depict the idea of market shares. I am totally happy
> > to hear of any suggestions of other solutions that are superior to pie
> > charts.
> >
> > I came across several solutions, although most require the package
> > pgf-pie to be installed, which apparently does not come with my TeX-Live
> > 2013 (LaTeX, LuaTeX, XeLaTeX) on my Linux. As I mentioned in previous
> > post, due to rather uncomfortable time constraints, I would like to
> > tinker as few a possible with my TeX-installation.
> >
> > 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.
> >
> >
> > \documentclass{article}
> >
> > \usepackage{calc}
> > \usepackage{ifthen}
> > \usepackage{tikz}
> > \begin{document}
> > \newcommand{\slice}[4]{
> > \pgfmathparse{0.5*#1+0.5*#2}
> > \let\midangle\pgfmathresult
> >
> > % 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{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{tikzpicture}[scale=3]
> >
> > \newcounter{a}
> > \newcounter{b}
> > \foreach \p/\t in {20/type A, 4/type B, 11/type C,
> > 49/type D, 16/other}
> > {
> > \setcounter{a}{\value{b}}
> > \addtocounter{b}{\p}
> > \slice{\thea/100*360}
> > {\theb/100*360}
> > {\p\%}{\t}
> > }
> >
> > \end{tikzpicture}
> >
> > \end{document}
> >
> > 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.
> >
> >
> > Thanks in advance for you kind help,
> >
> > Pascal
>
> Howdy,
>
> Why not download the pgf-pie package and use it. There is only one file (plus the documentation and example files) which you place in the same directory as your source. Not a big deal. You can get it from <http://www.ctan.org/pkg/pgf-pie>.
>
> Good Luck,
>
> Herb Schulz
Thank you so much Herb,
I can't believe how easy it was to get pgf-pie installed an working. The
documentation is pretty straightforward, although I will have to fiddle
a little bit with that: Getting sans-serif fonts, just to see whether
that looks goods, and a caption/label for the pie-chart. Maybe someone
knows a quick response to that.
I will also have a look into the other kind replies by others who have
answered my post on this list.
Thanks to all,
Pascal
>
>
>
More information about the texhax
mailing list