Highlight a line in ggplot with multiple lines

前端 未结 3 618
长情又很酷
长情又很酷 2020-12-11 08:23

I want to change the size, linetype, color etc. for one line in ggplot. Here is a minimal reproducible example:

library         


        
3条回答
  •  被撕碎了的回忆
    2020-12-11 09:02

    Not every line but you can plot only 'Country1' separately :

    library(ggplot2)
    
    ggplot(subset(df_long, variable != 'Country1'), aes(x = Horizons, y = value)) + 
      geom_line(aes(colour = variable, group = variable)) +
      geom_line(data = subset(df_long, variable == 'Country1'), 
                size = 3, linetype = 'dashed', color = 'blue') +
      theme_bw() 
    

提交回复
热议问题