O'Reilly logo

R Data Visualization Cookbook by Atmajitsinh Gohil

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required