geom_sf_taiwan: Generate Taiwan choropleth map to city or township level...

View source: R/geom.R

geom_sf_taiwanR Documentation

Generate Taiwan choropleth map to city or township level without any map supplied

Description

Generate Taiwan choropleth map to city or township level without any map supplied

Usage

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
)

Arguments

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

Examples

ggplot() +
  geom_sf_taiwan(
    data=gg_drug$data,
    map_id="發生地點",
    mapping=aes(fill=案件次數),
    type="鄉鎮區"
  )

tpemartin/econDV2 documentation built on Aug. 6, 2023, 11:46 p.m.