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: Add pop-up labels to a map of German cities
From the course: Creating Maps with R
Solution: Add pop-up labels to a map of German cities
(upbeat music) - Let's start solving this challenge by opening the popup geoscatter dot R script in the 05_08b project. And let's run the code from line 15 through to 1. So that's going to load our packages and define our two data sets. And I've started off our map on line 17 through 24. So this is already a geoscatter plot. The first thing that I want to do is I want to modify the fill color of each of the cities dependent on whether it's the capital or not. Let's print germany_cities to the console so we can see what we're dealing with. And we've got a column capital with either one or zero. It's quite hard to customize how this appears in the leaflet map itself. It's much easier to wrangle our code first. So let's go here and add a few lines and I'm going to take germany_cities. I'll pipe it into the function mutate and we'll create a new column called city_type which is what we'll use to change the fill of our…
Contents
-
-
-
-
-
-
-
The basics of using Leaflet2m 57s
-
(Locked)
Use Leaflet to visualize geo locations5m 41s
-
(Locked)
Add labels and pop-ups to Leaflet maps5m 6s
-
(Locked)
Leaflet choropleth and continuous data6m 17s
-
(Locked)
Leaflet choropleth and discontinuous data6m 3s
-
(Locked)
Set a background color with leaflet.extras1m 25s
-
(Locked)
Challenge: Add pop-up labels to a map of German cities35s
-
(Locked)
Solution: Add pop-up labels to a map of German cities6m 4s
-
(Locked)
Challenge: Interactive choropleth of state coastline length39s
-
(Locked)
Solution: Interactive choropleth of state coastline length6m 20s
-
-
-