Drawing a pie chart

Pie charts are popular for showing proportions. A pie chart's main characteristic is that all items usually sum up to 100 percent. They are displayed as segments of a disc.

As an example, we will use a pie chart to display the relative amount of questions about different TeX distributions.

How to do it...

We will use the pgf-pie package, which builds on TikZ and is specialized for generating pie charts. Follow these steps:

  1. Start with a document class:
    \documentclass{article}
    
  2. Load the pgf-pie package:
    \usepackage{pgf-pie}
    
  3. Begin the document:
    \begin{document}
    
  4. Begin a TikZ picture, which will be the container of the pie chart:
    \begin{tikzpicture}
    
  5. Draw a pie chart using this command:
     \pie [rotate = 180] {62/\TeX\ Live and Mac\TeX, 32/MiK\TeX\ ...

Get LaTeX Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.