4

I have plotted a polar pie chart in LaTeX.

Here is the code:

\begin{document}

\begin {tikzpicture}[thick]
\tikzstyle{every node}=[font=\LARGE]

\pie[polar, text=inside]{10.5/A, 20.8/B, 30.2/C, 40.4/D}


\end{tikzpicture}
\end{document}

I would like to add decimal values instead of integer. Like

10.45, 20.78, 30.67, 40.10.

How can I do that?

0

1 Answer 1

1

It seems that when using polar parameter you cannot use floats (only integers). To me it looks like package bug. Here would be the patch for the pgf-pie.sty (on the left is the new code, on the right the old code - I only show the part of pgf-pie.sty):

  %%%%%%%%%% CIRCLE PIE BGEIN %%%%%%%%%%%    %%%%%%%%%% CIRCLE PIE BGEIN %%%%%%%%%%%
  \ifpolar                                   \ifpolar
  \xdef\maxValue{0}                          \xdef\maxValue{0}
  \newdimen \@temp 
  \foreach \p/\e in {#2} {                   \foreach \p/\e in {#2} {
    \@temp=\maxValue pt
    \ifdim  \p pt > \@temp                     \ifnum \maxValue < \p
    \xdef\maxValue{\p}                         \xdef\maxValue{\p}
    \fi                                        \fi
  }                                          }

Alternatively copy code from pgf-pie.sty of the command \pie (257 lines of code) and change relevant part.

Here is working MWE with changed pgf-pie.sty:

\documentclass{standalone}
\usepackage{pgf-pie}
\begin{document}
\begin {tikzpicture}[thick]
\tikzstyle{every node}=[font=\LARGE]
\pie[polar,sum=auto,text=inside,after number={}]{10.45/A, 20.78/B, 30.67/C, 40.10/D}
\end{tikzpicture}
\end{document}
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .