Say I want to plot the relationship between x and y for four different variables. The lines are all pretty close together, and the plot has to be black and white. Below I give an example in ggplot where I use the linetype
aesthetic for the different variables. However, it is hard to tell them apart in the plot, since all the different kinds of dashed lines look similar. What other options do I have to make them easily distinguishable without using color?
library(ggplot2)
v <- rep(c("a", "b", "c", "d"), each = 25)
x <- rep(1:25, 4)
set.seed(123)
y1 <- cumsum(rnorm(25))
y2 <- cumsum(rnorm(25))
y3 <- cumsum(rnorm(25))
y4 <- cumsum(rnorm(25))
y <- c(y1, y2, y3, y4)
ggplot(data.frame(x, y, v), aes(x= x, y = y)) +
geom_line(aes(linetype = v))