Duplicate legend with geom_vline() in ggplot

烈酒焚心 提交于 2019-12-02 01:14:27

You can use override.aes in combination with hiding the linetype legend. With:

gp2 + 
  scale_color_manual(name = '', 
                     labels = c(ic = 'Limites I.C.', median = 'Mediana', h0 = 'Hipotese Nula'),
                     values = c(ic = 'red', median = 'black',h0 = 'grey40')) +
  guides(color = guide_legend(override.aes = list(linetype = c('dotted', 'dashed', 'solid'))),
         linetype = FALSE)

you will get this:

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!