I would like to have a line plot where I have 2 lines with 2 different color and each line would have sections colored in different shades of that color. Like a gradient shade for each line. e.g. a line with shades of blue for different regions along the x-axis
library(ggplot2) df <- data.frame(a = c(rep(0,10), rep(1,10)), b = c(rep(c(rep(0,3),rep(1,4),rep(2,3)), 2)), c = sample(1:20), d = c(1:20)) df ggplot(data = df) + geom_line(aes(x = d, y = c, color = factor(a), linetype = factor(b)))
Here I get each line with different color. Tried adding a different linetype to each section but that doesn't work. Each line should by itself have different shades based on column b


