Sketch counterparts of ggplot2::element_line() and ggplot2::element_rect().
Use them in ggplot2::theme() (or via theme_sketch(rough_frame = TRUE)) to
render gridlines, panel borders, and axis ticks with the same wobbly,
double-stroke look as the geoms. They accept the usual element arguments plus
the shared sketch parameters (roughness, bowing, n_passes, seed).
Usage
element_sketch_line(
colour = NULL,
linewidth = NULL,
linetype = NULL,
lineend = NULL,
color = NULL,
roughness = 0.5,
bowing = 0.5,
n_passes = 2L,
seed = NULL,
...
)
element_sketch_rect(
fill = NULL,
colour = NULL,
linewidth = NULL,
linetype = NULL,
color = NULL,
roughness = 0.6,
bowing = 0.4,
n_passes = 2L,
seed = NULL,
...
)Arguments
- colour, color
Line/border colour.
- linewidth
Line width.
- linetype
Line type.
- lineend
Line end style.
- roughness, bowing, n_passes, seed
Sketch parameters (see
geom_sketch_path()). Defaults are gentle, suited to a frame.- ...
Passed to the underlying ggplot2 element constructor.
- fill
Fill colour (
element_sketch_rect()only).NAdraws the outline only — the usual choice for a panel border.
See also
Other sketch-theme:
ggsketch_check_fonts(),
register_sketch_font(),
scale_roughness_continuous(),
scale_sketch,
sketch_palette(),
theme_sketch()
Examples
library(ggplot2)
ggplot(mtcars, aes(wt, mpg)) +
geom_sketch_point(seed = 1L) +
theme_sketch() +
theme(panel.grid.major = element_sketch_line(colour = "grey80", seed = 7L))
