theme_map.Rd
A ggplot2 theme for SOE map figures
theme_map(...)
library(rnaturalearth); library(ggplot2)
#> Error in library(rnaturalearth): there is no package called ‘rnaturalearth’
library(dplyr); library(sf)
#>
#> Attaching package: ‘dplyr’
#> The following objects are masked from ‘package:stats’:
#>
#> filter, lag
#> The following objects are masked from ‘package:base’:
#>
#> intersect, setdiff, setequal, union
#> Linking to GEOS 3.11.0, GDAL 3.5.3, PROJ 9.1.0; sf_use_s2() is TRUE
#Map line parameters
map.lwd <- 0.4
# Set lat/lon window for maps
xmin = -76
xmax = -66
ymin = 36
ymax = 45
xlims <- c(xmin, xmax)
ylims <- c(ymin, ymax)
#Get base map and set CRS
crs <- "+proj=longlat +lat_1=35 +lat_2=45 +lat_0=40 +lon_0=-77 +x_0=0 +y_0=0
+datum=NAD83 +no_defs +ellps=GRS80 +towgs84=0,0,0"
coast <- ne_countries(scale = 10,
continent = "North America",
returnclass = "sf") %>%
sf::st_transform(crs = crs)
#> Error in ne_countries(scale = 10, continent = "North America", returnclass = "sf"): could not find function "ne_countries"
#Plot with SOE theme
ggplot()+
geom_sf(data = coast) +
coord_sf(crs = crs, xlim = xlims, ylim = ylims) +
theme_map()