Get startedGet started for free

Exercise 13. Infant mortality scatter plot - part 3 - adding labels

Note that there is a large variation in infant mortality and dollars per day among African countries.

As an example, one country has infant mortality rates of less than 20 per 1000 and dollars per day of 16, while another country has infant mortality rates over 10% and dollars per day of about 1.

In this exercise, we will remake the plot from Exercise 12 with country names instead of points so we can identify which countries are which.

This exercise is part of the course

Data Science Visualization - Module 2

View Course

Exercise instructions

  • The mutated dataset is preloaded as gapminder_Africa_2010.
  • As in the previous exercise, make a scatter plot of infant_mortality versus dollars_per_day for countries in the African continent.
  • As in the previous exercise, use color to denote the different regions of Africa.
  • As in the previous exercise, transform the x axis to be in the log (base 2) scale.
  • Add a geom_text layer to display country names in addition to of points.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

gapminder_Africa_2010 %>% # your plotting code here
Edit and Run Code