I can't use theme_set() with theme_xkcd() in r-markdown document

A possible work-around is to use a theme that has all the required elements as the "base" and then add all the theme_xkcd() elements to it. I'll use theme_grey() for this.

(I don't have the xkcd fonts installed, so the axis font doesn't change in my example.)

library(ggplot2)
library(xkcd)

theme_set(theme_grey() + theme_xkcd() ) 

ggplot(cars, aes(speed, dist)) +
     geom_point()

Created on 2018-08-14 by the reprex package (v0.2.0).

5 Likes