theme_xkcd: Creates a XKCD theme

Description Usage Arguments Details Value Note References Examples

View source: R/theme_xkcd.r

Description

This function creates a XKCD theme for ggplot graphics.

Usage

1

Arguments

None

Details

It uses the XKCD fonts. You must install this type of fonts. See Note.

Value

A theme with white background and fonts of the XKCD family.

Note

To install the fonts (See the vignette):

download.file("http://simonsoftware.se/other/xkcd.ttf", dest="xkcd.ttf") system("mkdir ~/.fonts") system("cp xkcd.tff -t ~/.fonts") ##library(sysfonts) font.add("xkcd", regular = "xkcd.ttf")

References

fibosworld 2013. Change fonts in ggplot2, and create xkcd style graphs http://fibosworld.wordpress.com/2013/02/17/change-fonts-in-ggplot2-and-create-xkcd-style-graphs/

Various Authors 2012. How can we make xkcd style graphs in R? http://stackoverflow.com/questions/12675147/how-can-we-make-xkcd-style-graphs-in-r

http://simonsoftware.se/other/xkcd.ttf

Examples

1
2
3
4
5
## Not run:  
p <- ggplot() + geom_point(aes(mpg, wt), data=mtcars) + theme_xkcd()
p

## End(Not run)

Example output

Loading required package: ggplot2
Loading required package: extrafont
Registering fonts with R
Warning message:
In theme_xkcd() : Not xkcd fonts installed! See vignette("xkcd-intro")

xkcd documentation built on May 2, 2019, 4:47 p.m.