# 1. Basic provincial map (recommended: combine with geom_boundary_cn)
ggplot() +
geom_mapcn() +
geom_boundary_cn() +
theme_minimal()
# 2. City-level map with custom fill and boundaries
ggplot() +
geom_mapcn(
admin_level = "city",
fill = "grey95",
color = "grey60"
) +
geom_boundary_cn(province_color = "grey40") +
theme_bw()
# 3. Filter by attribute (e.g., English names) and highlight selected provinces
ggplot() +
geom_mapcn(
filter_attribute = "name_en",
filter = c("Beijing", "Shanghai"),
fill = "tomato"
) +
geom_boundary_cn() +
theme_minimal()
# 4. Use a different projection (e.g., Albers equal-area)
albers_cn <- "+proj=aea +lat_1=25 +lat_2=47 +lat_0=0 +lon_0=105 +datum=WGS84"
ggplot() +
geom_mapcn(crs = albers_cn, linewidth = 0.3) +
geom_boundary_cn(crs = albers_cn) +
coord_sf(crs = albers_cn) +
theme_minimal()
Run the code above in your browser using DataLab