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.
Chart legends and gridlines
From the course: Data Analysis with Python and Pandas
Chart legends and gridlines
- [Instructor] All right, and so now let's take a look at our chart legend. Our legend is often very important in a chart because it communicates to users what our lines represent. There are going to be some times when we might want to remove the legend altogether. Perhaps we're going to create a legend by hand in a tool like PowerPoint. These legends in Matplotlib can be very finicky, especially when we're only working with the Matplotlib API via Pandas. But by default, Pandas is going to try to place your legend in the best spot, so it's going to look for regions of your chart where there's a lot of white space in the hopes that we won't be obscuring any of our data. But if we look at this chart here, it's very hard to find a spot where there's enough white space inside our chart where our legend would not cover up our data. And so if you ever run into this, one easy way to take care of this would just be to say legend=False, and we no longer have a legend. Unfortunately, your…
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)
-
-
-
-
-