Remove legend ggplot 2.2

前端 未结 4 1470
太阳男子
太阳男子 2020-12-02 03:59

I\'m trying to keep the legend of one layer (smooth) and remove the legend of the other (point). I have tried shutting off the legends with guides(colour = FALSE)

4条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-02 04:38

    There might be another solution to this:
    Your code was:

    geom_point(aes(..., show.legend = FALSE))
    

    You can specify the show.legend parameter after the aes call:

    geom_point(aes(...), show.legend = FALSE)
    

    then the corresponding legend should disappear

提交回复
热议问题