powered by
A drop-in ggplot2::ggsave() wrapper that picks a device which can see fonts registered with register_sketch_font() / systemfonts:
ggplot2::ggsave()
register_sketch_font()
ggsketch_save( filename, plot = ggplot2::last_plot(), width = 8, height = 5, dpi = 300, device = NULL, ... )
Invisibly, filename.
filename
File to write; the extension picks the device.
Plot to save. Default ggplot2::last_plot().
ggplot2::last_plot()
Size in inches. Defaults 8 x 5.
Resolution for raster formats. Default 300.
Override the chosen device (a function or name); passed through to ggplot2::ggsave() untouched when supplied.
Other arguments passed on to ggplot2::ggsave().
.png / .jpeg / .jpg / .tiff -- ragg when installed (falls back to the ggsave default with a hint).
.png
.jpeg
.jpg
.tiff
.svg -- svglite when installed.
.svg
.pdf -- cairo_pdf (embeds registered fonts; the base pdf device does not).
.pdf
cairo_pdf
pdf
.eps / .ps -- cairo_ps, with a warning: PostScript cannot embed handwriting faces reliably, so prefer PDF.
.eps
.ps
cairo_ps
Other sketch-theme: CoordSketch, CoordSketchPolar, element_sketch_line(), ggsketch_check_fonts(), register_sketch_font(), scale_pressure_continuous(), scale_roughness_continuous(), scale_sketch, scale_tone_continuous(), sketch_palette(), theme_sketch()
CoordSketch
CoordSketchPolar
element_sketch_line()
ggsketch_check_fonts()
scale_pressure_continuous()
scale_roughness_continuous()
scale_sketch
scale_tone_continuous()
sketch_palette()
theme_sketch()
# \donttest{ library(ggplot2) p <- ggplot(mtcars, aes(wt, mpg)) + geom_sketch_point(seed = 1L) + theme_sketch() out <- file.path(tempdir(), "sketch.png") ggsketch_save(out, p) unlink(out) # }
Run the code above in your browser using DataLab