Generating an XKCD-style plot

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.

Generating an XKCD-style plot

Getting ready

To create a chart, we require to install the following packages:

  • xkcd
  • ggplot2

How to do it…

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")) ...

Get R: Recipes for Analysis, Visualization and Machine Learning now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.