[Tex/LaTex] Pie Chart without labels in beamer using pgf-pie


EDIT The accepted answer completely solves my immediate problem, but for more detailed analysis of the underlying issue please refer to answer by cfr. Basically, pstricks and pdfTex don't mix well.

I have a beamer presentation with a lot of pie charts. I use pgf-pie package because it is easy and (mostly) does what I need. I have one particular pie-chart that should have no labels at all. I have tried adding

/tikz/nodes={text opacity=0,overlay}

to the code following advice found here.

Small pie-chart without any numbers or text


\pie [explode=0.1, color={blue!70, green!80, red, yellow} ,/tikz /nodes={text opacity=0,overlay}]{10/, 20/, 30/, 40/}

Now, the strange thing is, the code works well in the example above (standalone class). However, it doesn't seem to do anything inside a beamer presentation, i.e. the labels still show. It seems that there is some sort of package conflict. How could I enable this to work in the beamer presentation? I know there are other ways to produce this but pgf-pie is quite handy otherwise.


\setbeamertemplate{navigation symbols}{}%remove navigation symbols
\setbeamercolor{alerted text}{fg=magenta}


Pie Chart Without Labels

Best Answer

The command \pgfpie@slice defined in pgf-pie.sty to draw circular diagram


  \path (#8) -- ++(\midangle:#5) coordinate(O);


  % slice
  \draw[line join=round, fill=#6, \style] (O) -- ++(#1:#7) arc (#1:#2:#7) -- cycle;

  \pgfmathparse{(max(\temp,-0.5) + 0.8)*#7}

    % label and number together
    \path (O) -- ++(\midangle:\innerpos) node
    % label
    \path (O) -- ++ (\midangle:\radius)
    node[inner sep=0, \pgfpie@text=\midangle:#4]{};

    % number
    \path (O) -- ++(\midangle:\innerpos) node

Numbers inside circle are defined with argument #3 of the command \pgfpie@slice, you can for example modify the definition of \beforenumber and \afternumber to obtain a phantom like command to hide numbers

For this you can just add before number=\phantom and after number=




\pie [explode=0.1,color={blue!70, green!80, red, yellow},before number=\phantom,after number=]
{10/, 20/, 30/, 40/}


enter image description here