From the course: R: Interactive Visualizations with htmlwidgets

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Change map styles in Leaflet

Change map styles in Leaflet - R Tutorial

From the course: R: Interactive Visualizations with htmlwidgets

Start my 1-month free trial

Change map styles in Leaflet

- [Instructor] When creating interactive maps, one of the things people care about most is how does the map look. Are geographic features like mountains shown? Is socio-political information like country borders included? Or do you simply want to a plain map with the outline of the land masses of Earth? Let's look at how we can customize the appearance of maps in Leaflet. In our exercise files, let's open up default-map-style.R. I'm going to decrease the size of my environment because I don't need it for this exercise. At the top of the script file, we load two libraries: first is the tidyverse library for importing and wrangling data and second is the Leaflet library which we're going to use to create our interactive map. I'll load this with Command + Enter then on Line 4, I use read underscore csv from the read.R library to import my CSV file against the variable capital underscore cities. Now, Lines 8 through 12 are where I've defined my interactive map. Let's evaluate this in…

Contents