-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
R Data Visualization Cookbook
By :
If you have never read or seen xkcd cartoon strips, then I would highly recommend that you do. Some of the humor is sarcastic and entertaining. The idea behind generating an XKCD-style plot is to bring the same humor to our plot and try to make our visualization convey an idea or a story which is interesting and entertaining.

To create a chart, we require to install the following packages:
xkcd
ggplot2
We will install the two required packages and load them in our active R session using the install.packages()and library() functions:
install.packages(c("xkcd","ggplot2"))
windowsFonts(xk = windowsFont("xkcd"))
library(xkcd)
library(ggplot2)The windowsFonts() function allows us to customize our fonts in R:
windowsFonts(xk = windowsFont("xkcd"))In order to create a theme, we use the theme() function in ggplot2. Note that our aim in this recipe is to understand ways to generate xkcd plots. Users can refer to the ggplot2 manual for more clarification...
Change the font size
Change margin width
Change background colour