# Pie chart not using percent numbers

You see the following code, which draw you a pie chart

\documentclass{article}
\usepackage{pgf-pie}

\begin{document}
\begin{tikzpicture}

\pie[rotate=20, color={white}, sum=auto, after number=, radius=2] {10/, 10/, 10/, 10/, 10/,10/, 10/, 10/}

\end{tikzpicture}
\end{document}




I want the numbers 1 to 8 instead of 10. Is this with the command \pie possible?

• Do you want the segments to be each 1/8 of total size and just number it from 1 to 8? Dec 18 '15 at 12:05
• @moospit yes that's right. When I write the numbers 1 to 8 in the command line. LateX change the size of this pie, The 8 sectors of the circle should be the same size, only the description should be different (from 1 to 8 instead of 10) Dec 18 '15 at 12:32

I am not aware if pgf-pie is supporting this. Otherwise you can use the following code to create your chart. It could also be used in a newcommand or the pic-environment to make it reusable.

You can adjust the parameters mysegments (number of segements) and myradius (radius of segments) for customization.

\documentclass[tikz, border=5mm]{standalone}

\begin{document}
\begin{tikzpicture}
\def\mysegments{8}
\foreach \x in {1,...,\mysegments} {
}
\end{tikzpicture}
\end{document}


Or with 15 segments (\def\mysemgments{15}):

If you want the segments to be able to have different sizes, you can do it like this:

## Code

\documentclass[tikz, border=2mm]{standalone}

\begin{document}

\newcommand{\Pie}[4][white]%
%[fill color] parts/color, size, rotate
{   \xdef\PieSum{0}
\foreach \Seg/\Col in {#2}
{   \pgfmathparse{\PieSum+\Seg}
\xdef\PieSum{\pgfmathresult}
}
\xdef\PieDone{0}
\begin{scope}[rotate=#4]
\foreach \Seg/\Col [count=\C] in {#2}
{   \pgfmathsetmacro{\PieDeg}{\Seg/\PieSum*360}
\fill[#1, \Col, draw=black] (0,0) -- ++ (\PieDone:#3) arc (\PieDone:\PieDone+\PieDeg:#3) -- cycle;
\node at  (\PieDone+\PieDeg/2:#3*0.7) {\C};
\pgfmathparse{\PieDone+\PieDeg}
\xdef\PieDone{\pgfmathresult}
}
\end{scope}
}

\begin{tikzpicture}
\Pie[orange!50]{5/blue!50,7/,13/,19/green!50,11/}{5}{90}
\end{tikzpicture}

\end{document}


## Output

I understand the question as asking how to create the desired image with the pgf-pie package (not how to do it somehow with TikZ) and this is how it works:

\documentclass[tikz, border=5pt]{standalone}
\usepackage{pgf-pie}

\begin{document}
\begin{tikzpicture}[]
`