I\'m plotting two semi-transparent ribbons together. Using the code below, without the scale_fill_manual
portion, I get basically what I want, with a legend cal
You can override the aesthetics in the legend by adding:
+ guides(fill = guide_legend(override.aes= list(alpha = 0.4)))
to your ggplot call.
But as with most things in ggplot, it is probably simpler to arrange your data in a way that makes the multiple geom_ribbon
calls unnecessary:
dt1 <- data.frame(x = c(x,x),
ymin = c(y1,y3),
ymax = c(y2,y4),
grp = rep(c('red','blue'),each = 10))
ggplot(data = dt1,aes(x = x,ymin = ymin, ymax = ymax,fill = grp)) +
geom_ribbon(alpha = 0.4) +
scale_fill_manual(name = "legendname",
values = c('red','blue'),
labels = c('one','two'))