Let us go back to where we stopped developing our mapping techniques yesterday: Our Covid-19 Map. This is just a super short repetition of what was just presented. No worries, we’re going to have some time to improve your maps in the second exercise.

1

Recreate a simple Covid-19 map as already created yesterday but use ggplot2 this time.

They don’t have to match perfectly but:

  • Use either the cases per 100.000 inhabitants or cases per 100.000 inhabitants in the last seven days.
  • Choose a color palette.
  • Name your legend and change its position.
  • Your map should have a title.
# For importing the data, you can use this code:
library(dplyr)
library(sf)

attributes_districts <-  read.csv("./data/attributes_districts.csv", 
                                  header = T, fill = T, sep = ",") 

german_districts_enhanced <- st_read(dsn = "./data",
                           layer = "GER_DISTRICTS") %>% 
                           rename(., district_id = id) %>% 
                          st_transform(., crs = 3035) %>% 
                          left_join(., attributes_districts, by = "district_id")

2

Save your map as a .pdf!

You need the function ggsave to fulfill this task.

3

Now we want to add another layer to see if enough hospitals are located in the Covid-19 high-risk zones of Germany.

  • Add the hospital layer to the map
  • Change the color of the points

For an extra challenge which we haven’t covered: The hospital shapefile contains information on the number of beds in each hospital. Can you change the size of hospital dots according to the number of beds?

Make sure that the CRS of your hospital layer is defined correctly!

You need to define size = beds as the aesthetics of the new layer.

The variable beds is a character but need to be numeric.