I need to create this Pie diagram

\mypie{x,y,82}{basecolor}{Fillcolor}{Some Text,L}

x= radius of first circle, y= radius of second concentric circle(This is to control the size of the circle and the thickness between two concentric circles, Feel free to provide another way to provide values if you wish)

  • 82 is the percent shall come as 82% as shown in the middle written using Fillcolor
  • "Some Text" will position itself relatively centered either Left or Right of the Pie[L as in here Left, R should make the text appear Right] Here Base color is Gray and Fill color is green as in the picture here.


 \mypie{x,y,82}{basecolor}{Fillcolor}{Some Text,L}{3D}
  • Give an optional switch to get a 3D Pipe like effect of the above pie, a rounded pipe like effect rather than the above Flat 2D effect.

Well, here's a custom solution with Tikz and xstring. The command goes like this:

\percentage[ <optional> ]{ <radius,perc> }{ <color1,color2> }{ <label,position> }
  1. The optional argument takes a length such as 1.5mm and so on. Default is 2pt.
  2. The second argument takes actually two values as shown, comma separated. The radius determines the size of the circles (not their width), while the percentage calculates the progress circle bar and of course, the central label.
  3. The third argument takes the colors, below first, progress bar second.
  4. The last argument takes the label along with its position. In this case I left the default position names because it'd be pointless to just rename them for this command. They are the following:
    • above, right, left, below
    • above right/left, below right/left
    • You can also use arbitrary angles, such as: 90 (above), 45 (above right) and so on.


enter image description here



    \draw[\backl, line width=#1] (90:\lwidth mm) arc (90:-270:\lwidth mm); 
    \draw[\percl, line width=#1] (90:\lwidth mm) arc (90:\endangle:\lwidth mm);
        minimum size=\halfw mm, 
        ] {$\perc\%$};

\percentage{7,64.90}{gray!20,green}{Some text,above right}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.