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
From the course: Data Analysis with Python and Pandas
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
(Locked)
The Matplotlib API and the plot() method9m 33s
-
(Locked)
Challenge: Basic line chart49s
-
(Locked)
Solution: Basic line chart3m 1s
-
(Locked)
Chart titles3m 26s
-
(Locked)
Chart colors5m 13s
-
(Locked)
Line styles2m 1s
-
(Locked)
Chart legends and gridlines3m 51s
-
(Locked)
Chart styles4m 8s
-
(Locked)
Challenge: Stylized line chart1m 11s
-
(Locked)
Solution: Stylized line chart1m 21s
-
(Locked)
Subplots and figure size5m 28s
-
(Locked)
Challenge: Subplots1m 33s
-
(Locked)
Solution: Subplots2m 59s
-
(Locked)
Bar charts6m 13s
-
(Locked)
Grouped and stacked bar charts5m 9s
-
(Locked)
Challenge: Bar charts1m 11s
-
(Locked)
Solution: Bar charts2m 19s
-
(Locked)
Pie charts and scatterplots6m 52s
-
(Locked)
Challenge: Scatterplots1m
-
(Locked)
Solution: Scatterplots2m 10s
-
(Locked)
Histograms3m 46s
-
(Locked)
Challenge: Histograms33s
-
(Locked)
Solution: Histograms1m 18s
-
(Locked)
Saving plots and further exploration3m 41s
-
(Locked)
Key takeaways2m 12s
-
(Locked)
-
-
-
-
-