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 subplots

Matplotlib subplots - Python Tutorial

From the course: Python Functions for Data Science

Start my 1-month free trial

Matplotlib subplots

- [Instructor] When visualizing your data, sometimes you may want to create multiple plots and display them all in one figure. These are called subplots, and I'll be showing you how to make subplots, using matplotlib's functions. Let's say that I have a pandas series containing students grades on exam number one in a particular course, and I stored it in a variable named exam one grades. I've displayed the first few values in exam one grades here. And I have another pandas series containing students grades on exam number two in the same course, and I stored it in a variable named exam two grades. I've displayed the first few values in exam two grades here. Now say I want to create two horizontally stacked subplots to display a histogram for exam one grades, and histogram for exam two grades side by side. I can use the subplots function from the pyplot sub module of matplotlib, it will look like this. First, I'll…

Contents