0

I am trying to customize the look of xkcd style plots in R, using the xkcd package. I want to invert the color, to make all the text and lines white. I was able to change the text using theme(). I can change axis and tick lines the same way, but I cannot figure out a way to change the line color (and size) of the fuzzy lines drawn with xkcdline.

data <- data.frame(x1=c(1,2), y1=c(10,20), xend=c(2.5,0.5),
yend=c(20,10), model=c("low","high"))

ggplot() + xkcdline(mapping=aes(xbegin=x1 +y1, ybegin=y1, 
xend =xend, yend= yend, color = model), data=data) +
xkcdaxis(range(0:20),range(10:20))

this can change the color of the lines according to the mapped aesthetic, but what if I want all the lines to be blue? I thought this would work

ggplot() + xkcdline(mapping=aes(xbegin=x1 +y1, ybegin=y1, 
xend =xend, yend= yend), data=data, color = "blue") +
xkcdaxis(range(0:20),range(10:20), color = "blue")

but it just seems to ignore the color assignment and the result is black lines. I could just use a dummy variable and change the color manually, but that trick would not work with xkcdaxis(). Any suggestions?

Take
  • 1
  • 1
  • [This answer](https://stackoverflow.com/a/27633134/2461552) used "colour" instead of "color", but does appear to set the color to a constant for rectangles. Does that code work for you in the current version of **xkcd**? – aosmith Jun 06 '18 at 16:31
  • @aosmith thanks for the suggestion. Setting `color` or `colour` works as you would expect in `xkcdrect()` but not in `xkcdline()` or `xkcdaxis()`... I am working with xkcd 0.0.5 and ggplot2 2.2.1 by the way. – Take Jun 08 '18 at 01:02

0 Answers0