[Tex/LaTex] Pie chart not using percent numbers

pgf-pietikz-pgf

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?

Best Answer

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}
    \def\myradius{2}
    \foreach \x in {1,...,\mysegments} {
        \draw (0,0) --++ (360/\mysegments*\x:\myradius) arc (360/\mysegments*\x:360/\mysegments*(\x+1):\myradius);
        \node at (360/\mysegments*\x-180/\mysegments:\myradius/2) {\x};
    }
  \end{tikzpicture}
\end{document}

rendered image

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