library(ggplot2)
# \donttest{
# Example 1: China (AEQD projection) with geographic limits
china_proj <- "+proj=aeqd +lat_0=35 +lon_0=105 +ellps=WGS84 +units=m +no_defs"
ggplot() +
geom_world(crs = china_proj) +
coord_proj(
crs = china_proj,
xlim = c(60, 140),
ylim = c(-10, 50)
) +
theme_minimal()
# Example 2: Zooming into a specific region
# Even though the map is projected (Robinson), we specify limits in Lat/Lon
crs_robin <- "+proj=robin +lon_0=0 +datum=WGS84"
ggplot() +
geom_world(crs = crs_robin) +
coord_proj(
crs = crs_robin,
xlim = c(-20, 50), # Focus on Africa/Europe
ylim = c(-40, 40)
) +
theme_minimal()
# }
Run the code above in your browser using DataLab