From the course: Creating Maps with R

Unlock the full course today

Join today to access over 24,200 courses taught by industry experts.

Solution: Label a geobubble chart of Germany's biggest cities

Solution: Label a geobubble chart of Germany's biggest cities

From the course: Creating Maps with R

Solution: Label a geobubble chart of Germany's biggest cities

(techno music) - Let's start solving this challenge by running the code that I've already given you. So, let's run lines 15 through 1. It's going to load our packages and define our data sets and then line 18 through 21, I'm starting off the visualization. We've just border of Germany. So, let's add our German cities with geom_sf, add a plus, so I don't forget it. Go back inside of brackets, and add data is equal to germany_cities. So that makes us a geo scatter plot but we want this to be a geo bubble chart, so let's add aes, size is going to be equal to the pop column. And so now that's a geo bubble chart. Our next part of the challenge is to label for cities in a map. So we're going to use the "ggrepel" package for that. But remember, ggrepel doesn't know how to work with SF objects, so, we need to turn Germany cities into a data frame. We start that process by taking germany_cities and piping it into…

Contents