From the course: Creating Maps with R
Unlock the full course today
Join today to access over 24,200 courses taught by industry experts.
Leaflet choropleth and discontinuous data
From the course: Creating Maps with R
Leaflet choropleth and discontinuous data
- Let's use Leaflet to create choropleth of discreet variables using the script in the O-5-O-5-B project. Let's start by running the script from lines 20 through to 1. So that's going to load our packages. It's going to obtain ship files for the contiguous United States and it's going to join those together on line 18 through 20. Then lines 22 through 29, I'm defining a custom color palette using a named vector and lines 31 through 33 I've started off our choropleth. So if I run that code we get the outline of the contiguous United States. Now I'm going to improve this map right away by changing the width of the lines. So I'll add weight is equal to one and now I need to create a fill pallet for my choropleth. So I'll add a couple of new lines here and let's create my pallet. So I'll call it pal popular pet and I'll use the function color factor. Color factor allows us to provide named palettes. And it also…
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
-
-
-