The sf companion to coord_sketch(): a drop-in replacement for
ggplot2::coord_sf() that draws the graticule (the lines of longitude and
latitude) and the axis ticks hand-drawn, under any theme. It projects and
lays out the map exactly as coord_sf() does and only swaps how those lines
are drawn.
Usage
coord_sketch_sf(
...,
roughness = 0.5,
bowing = 0.5,
n_passes = 2L,
seed = NULL,
rough_grid = TRUE,
rough_ticks = TRUE
)Arguments
- ...
Arguments passed on to
ggplot2::coord_sf(), such ascrs,xlim,ylim,expand,datum,label_graticule,label_axes,defaultandclip.- roughness, bowing, n_passes
Sketch parameters for the graticule and ticks. Gentle defaults suited to gridlines (
0.5,0.5,2).- seed
Integer seed for reproducible wobble.
NULLusesgetOption("ggsketch.seed", 1L).- rough_grid, rough_ticks
Roughen the graticule / axis ticks under any theme? Both default
TRUE. WithFALSE, they are drawn as the theme draws its grid lines and ticks: hand-drawn when those areelement_sketch_line()s, crisp otherwise.
Details
geom_sketch_sf() adds one of these by default, with rough_grid and
rough_ticks off: the graticule is then drawn hand-drawn only when the
theme's major grid lines are element_sketch_line()s, as under
theme_sketch(rough_frame = TRUE), and crisp otherwise, as with
coord_sf(). A coord_sf() added to the plot replaces it, and draws a
crisp graticule under any theme; add coord_sketch_sf() instead to pick a
projection and keep the graticule hand-drawn.
Examples
library(ggplot2)
nc <- sf::st_read(system.file("shape/nc.shp", package = "sf"), quiet = TRUE)
ggplot(nc) +
geom_sketch_sf(fill = "grey85", seed = 1L) +
coord_sketch_sf(crs = 32119, seed = 1L)
# Under theme_sketch(rough_frame = TRUE) geom_sketch_sf()'s own coord
# draws the graticule hand-drawn too.
ggplot(nc) +
geom_sketch_sf(fill = "grey85", seed = 1L) +
theme_sketch(rough_frame = TRUE)
