...

/

How to Draw a Pie Plot

How to Draw a Pie Plot

In this lesson, we will learn how to represent the proportions of categorical data using the pie plot.

What is pie?

Pie charts are often used to highlight the proportion of categorical data in relation to the overall value of a dataset. Pie charts are shaped like a pie, and each category that takes up a part of the pie is shaped like a slice. The larger the slice, the greater the proportion of the overall values it represents.

Now, let’s learn how to make some delicious pies.

Plotting a pie chart by using pie()

Like with other plot types, the basic function in Matplotlib to plot a pie chart is pie(). Below are some of the important parameters we may need:

  • x: The list of data we want to present for each WedgeWedge.
  • explode: Set as None or as a list of values that are the same length as x. Each item
...