plot_single_map | R Documentation |
Creates a thematic map using the tmap
package for a single variable in an sf object.
plot_single_map(sf_data, var, title, palette = "reds")
sf_data |
An sf object containing spatial data. |
var |
Variable name as a string to map. |
title |
Legend title for the fill legend. |
palette |
Color palette for the map (default is "reds"). |
A tmap object representing the thematic map.
library(sf)
# Create example sf object
nc <- st_read(system.file("shape/nc.shp", package = "sf"), quiet = TRUE)
nc$incidence <- runif(nrow(nc), 0, 100)
# Plot
p1 <- plot_single_map(nc, "incidence", "Incidence")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.