15.071 | Spring 2017 | Graduate

The Analytics Edge

7.2 Visualizing the World: An Introduction to Visualization

7.2 Visualizing the World: An Introduction to Visualization

Quick Question

Create the fertility rate versus population under 15 plot again:

ggplot(WHO, aes(x = FertilityRate, y = Under15)) + geom_point()

Now, color the points by the Region variable.

Note: You can add scale_color_brewer(palette=“Dark2”) to your plot if you are having a hard time distinguishing the colors (this color palette is often better if you are colorblind). To use this option, you should just add scale_color_brewer(palette=“Dark2”) to your plotting command right after geom_point().

One region in particular has a lot of countries with a very low fertility rate and a very low percentage of the population under 15. Which region is it?

  
  
  
  
  
  

Explanation You can color the points by region if you adjust the command to the following: ggplot(WHO, aes(x = FertilityRate, y = Under15, color=Region)) + geom\_point() Most of the countries in Europe have a very low fertility rate and a very low percentage of the population under 15.

Back: Video 5: Advanced Scatterplots Using ggplot

Course Info

As Taught In
Spring 2017
Level
Learning Resource Types
Lecture Videos
Lecture Notes
Problem Sets with Solutions