From the course: Data Analysis with Python and Pandas

Unlock this course with a free trial

Join today to access over 24,900 courses taught by industry experts.

Subplots and figure size

Subplots and figure size

- [Instructor] So one other useful feature worth being aware of is subplots. By default, when we plot a DataFrame with multiple numeric series, those are all going to be plotted within the same chart area. And a lot of the times, that's going to be the behavior that we want, but if we ever want to break these out into separate plots, subplots allow us to create a separate chart for each series of our data. So here, we're plotting our sales DataFrame, and we're calling the plot method with the argument "subplots=True" specified. When we do this, we can now see that we have four individual line charts, and so by default, this is going to stack all of our charts into a single quote-unquote "column." So we'll have beverage, alcohol, grocery, prepared foods, and any other series which is to be stacked below these. But we can modify this behavior if we specify a layout. So here, we're specifying our layout is going to be a 2x2 grid, so two rows, two columns, and we can now see that we have…

Contents