Description Usage Arguments Value Examples
This function provides a basic interactive map. By default it contains three basemap layers: OpenStreet Maps streets, a global orthophoto, and a global terrain map. This is indended to get things started with an interactive map to which additional layers will be added by the user.
1 |
data |
Optional spatial data source containing the spatial information to be plotted in the interactive map. |
A tmap object with tmap_mode()
set to view
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | library(tmap)
library(magrittr)
data('World', 'metro')
## Use the example world data to create an interactive map
tmap_base() +
## Add country polygons, colored by the Happy Planet Index
tm_shape(World) +
tm_polygons('HPI') +
## Add cities, sized proportional to population, with clustering
tm_shape(metro) +
tm_dots(
size = 'pop2020',
col = 'blue',
clustering = TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.