From the course: Data Analysis with Python and Pandas
Unlock this course with a free trial
Join today to access over 25,300 courses taught by industry experts.
Solution: Stylized line chart
From the course: Data Analysis with Python and Pandas
Solution: Stylized line chart
- All right, everybody. Our solution code is up on the right. Let's go ahead and dive into the notebook. All right, so a couple ways to do this problem. The first thing that we want to do is import seaborn and set our style to dark grid. Again, you could have used a different style. I'm not going to review your work, so hopefully you're able to have a little bit of fun trying out the different styles. The next thing that I did was I renamed our, you know, dcoilwtico to oil price. That's going to make it very intuitive for our audience to understand. And then we're going to go ahead and move on to plotting. So we want to set our index to be our date, and we can chain the astype command to this. So we'll automatically get our index into a daytime format. You might have done this in a separate step, and that's just fine. We're then calling the plot method. We're setting a title, X axis label, Y axis label, and then just setting our color to black. And that will return this chart, which I…
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)
-
-
-
-
-