Pie Charts

This article continues the earlier LaTeX chart tutorials by focusing on pie charts and several related chart styles using the pgf-pie package.
Pie charts are commonly used to display proportions or comparisons. With pgf-pie, you can also create polar charts, cloud charts, and square charts from a similar syntax.
Chart Types
This article covers:
- standard pie charts
- polar charts (
polar area charts) - cloud charts
- square charts
Standard Pie Chart
Basic steps:
- open a LaTeX editor such as Overleaf
- use the
articledocument class - load the
pgf-piepackage - draw the chart inside a
tikzpictureenvironment
Basic example:
\documentclass{article}
\usepackage{pgf-pie}
\begin{document}
\begin{tikzpicture}
\pie[rotate=90]{25/GeoGebra, 20/Blogger, 15/Edmodo, 20/\LaTeX, 20/Moodle}
\end{tikzpicture}
\end{document}Result:

In this example, rotate=90 changes the starting position of the chart by 90°.
Polar Chart
In a polar chart, each sector has an angle and radius based on the represented value.
Use:
\pie[polar, explode=0.1, text=legend]{25/GeoGebra, 20/Blogger, 15/Edmodo, 20/\LaTeX, 20/Moodle}Compiled result:

If you want the sectors to touch each other, remove explode. If you want the labels inside the sectors, use text=inside.
Example:
\pie[
polar,
rotate=270,
text=inside,
color={blue!55, green!60, red!70, yellow!50, magenta!60}
]{25/GeoGebra, 20/Blogger, 15/Edmodo, 20/\LaTeX, 20/Moodle}Result:

Cloud Chart
A cloud chart draws a set of disks whose sizes depend on the data values, with labels placed inside them.
Code:
\pie[cloud, text=inside, scale font, radius=3]{25/GeoGebra, 20/Blogger, 15/Edmodo, 20/\LaTeX, 20/Moodle}Result:

Square Chart
The package can also generate a square-style chart.
Code:
\pie[square, scale font, color={blue!65, red!65, green, yellow, cyan}]{25/GG, 20/Blogger, 15/Edmo, 20/\LaTeX, 20/Moodle}Compiled result:

Closing
With pgf-pie, creating statistical diagrams in LaTeX is fairly concise. You can adjust the rotation, colors, label positions, and chart type depending on the presentation you need.




