From the course: Python Functions for Data Science

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Matplotlib pie charts

Matplotlib pie charts - Python Tutorial

From the course: Python Functions for Data Science

Start my 1-month free trial

Matplotlib pie charts

- [Instructor] Another type of plot that Matplotlib supports is the pie chart. In this video I'll be showing you how to create a pie chart using Matplotlibs functions. Let's say that I have a pandas dataframe containing the weighted components used to give students their grades in a particular course as shown here. Now say, I want to create a pie chart of this data, and I want my pie chart to illustrate the breakdown of students' course grades, such that each category and its corresponding weight is shown. I can use the pie function from the pyplot submodule of Matplotlib. It would look like this. First I'll call the figure function and pass in the keyword argument figsize so that the figure size is seven by seven. Next I'll call the pie function like this. Then I'll call the title function to set the title of the plot. Lastly, I'll call the show function to make sure that the plot gets displayed. And that's it.…

Contents