From the course: Data Visualization in R with ggplot2 (2018)
Unlock the full course today
Join today to access over 24,800 courses taught by industry experts.
Adding institution size and control
From the course: Data Visualization in R with ggplot2 (2018)
Adding institution size and control
- [Instructor] If you have access to the exercise files for this course, you'll find the code that I have loaded here in the start file of the directory for this video. This simply builds the map that we finished with in the previous video. I'd now like to add some additional dimensions to the data. I'd first like to include the type of institution using color information. I'd like public schools colored one way and private schools represented using a different color. I can do this by adding a color aesthetic to my point geometry and mapping that aesthetic to the control variable in the college dataset. To do this, I just need to modify the geom_point call so that inside the aesthetic mapping, I add another aesthetic. I'm going to map the color aesthetic to the control variable and now when I run this visualization, schools are plotted differently according to their type of institutional control. Private schools have this salmon color and public schools have a light blue color. Now…
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.