Legend with geom_line and geom_ribbon

前端 未结 3 1386
误落风尘
误落风尘 2020-12-30 07:08

I am creating a figure where I have a line and confidence bands around it. To do this, I am using both geom_line and geom_ribbon in ggplot2

3条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-30 07:47

    Try to keep the colour outside aes, then it won't show on legend:

    h1 + geom_ribbon(aes(ymin=lower, ymax=upper, x=x), colour = "red", alpha = 0.3)
    

    enter image description here

提交回复
热议问题