Skip to content
R for the Rest of Us Logo

Mapping with R

34 lessons

Make a Choropleth Map of Discrete Variables with ggplot2 (02_06)

This lesson is locked

Get access to all lessons in this course.

If the video is not playing correctly, you can watch it in a new window


Click on the transcript to go to that point in the video. Please note that transcripts are auto generated and may contain minor inaccuracies.

Your Turn

Open up the 02_06 project.

Use the your-turn.R script in 02_06 to make this map.

  • Use the custom colors.

  • Ensure the guide is ordered by size of region.

  • Add a title to the guide.

Learn More

In this video there was quite a lot of information about how to work with factors using the {forcats} package.

While factors are part of base R it’s fairly painful to manipulate the levels of factors without the {forcats} package. The factors chapter of R for Data Science gives a great overview of both factors and {forcats}.

The paletteer package is an excellent resource for discovering useful color palettes. However, it’s very important to consider if your maps will make sense to readers with color blindness. Thankfully, the {colorblindr} package simplifies this with the following code:


Have any questions? Put them below and we will help you out!

You need to be signed-in to comment on this post. Login.

Kristina Bratkova

Kristina Bratkova

March 5, 2022


thanks for this clear video. I was wondering if lines 37-38 are redundant if scale_fill_manual is used? (scale_fill_manual is set by the ordered factor given in the list of colours (which was set by base R syntax to be in order of descending area of the region))

Oscar Tetteh

Oscar Tetteh

April 8, 2023

Hello Charlotte,

I am trying to relate this to my current research. I have a shapefile and data sets. The aim is to map the data set to the shapefile. could you please help me with the codes or a recommendation?

Thank you