geom_sf_taiwan | R Documentation |
Generate Taiwan choropleth map to city or township level without any map supplied
geom_sf_taiwan(
data,
map_id,
...,
type = c("縣市", "鄉鎮區"),
cast2multipolygon = T,
merge_type = "joint",
need_background = T,
background.fill = "#c8c5be",
background.color = "#c8c5be",
background.size = 0
)
data |
A data frame with map_id to merge with underlying implicit Taiwan map sf object |
map_id |
A character showing the name of the map_id in data input. The data[[map_id]] will be used to join with sf_taiwan_simplied$台灣本島$xxx's map_id column where xxx is determined by type input value. |
... |
other parameters passed to geom_sf |
type |
either "縣市" or "鄉鎮區" |
merge_type |
default="joint". "join" means sf inner_join data, "map" means sf left_join data, "data" means sf right_join data |
need_background |
default is TRUE. If FALSE, just return the choropleth layer. |
background.fill |
the fille of background Taiwan map |
background.color |
the color of background Taiwan map |
background.size |
the size of boundary of background map |
ggplot() +
geom_sf_taiwan(
data=gg_drug$data,
map_id="發生地點",
mapping=aes(fill=案件次數),
type="鄉鎮區"
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.