# Pie Charts

Another way to look at data involving categories having associated numerical values is a pie chart. Pie charts are especially useful when the categories represent parts of a whole, and where it's more useful to get a sense for the relative percentages involved.

Our examples explore the San Francisco 2016 crime dataset we've been investigating.

## Example: Crime by category

We can use a pie chart to break down crime by category:

A pie chart of crimes by category in San Francisco, 2016

As before, we're highlighting the top categories. Here we can see that larceny/theft accounted for over one-quarter of the crime in San Francisco in 2016, and that the other categories are comparatively smaller.

## Example: Crime by day of week

Here's a pie chart for crime by day of week:

A pie chart of crimes by day of week in San Francisco, 2016

From the pie chart, we can see that the crime volumes are roughly the same across the various days of the week. We saw in the previous sections that Fridays and Saturdays have slightly higher counts, but that's less obvious with a pie chart. Indeed it is a weakness of pie charts that they make it hard to do this kind of precise comparison.

## Exercises

Exercise 1. Use the San Francisco 2016 crime dataset to create a pie chart for crime by district.

Exercise 2. How would you compute the angle measure for any given slice of the pie?