From the course: Python for Data Science Tips, Tricks, & Techniques
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Finish your plots - Python Tutorial
From the course: Python for Data Science Tips, Tricks, & Techniques
Finish your plots
- If we're going to deliver good insights and present data that has a strong message behind it to our users, we need to make sure that we put on all the finishing touches so they can read it without us having to explain it to them. Here what I'm going to do is take a look at doing things like adding titles and colors, and using custom labels in ggplot. I'm going to start just by importing our libraries. From there, I'm going to do a real basic plot using some data that comes in, which is the miles per gallon data set, and we're just have a simple scatter plot here with the city versus highway miles, you can see a dot represented for every point there. Now if you want to add a title, beyond the typical way that we draw this, I need to add a new function called a ggtitle. And so here I'm going to call it city versus highway miles per gallon. And you can see that right here on my screen, right above the plot. Now if I wanted to add some custom labels in addition to my title, I can set…
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.