Add a dotted vertical line on certain x-axis values using ggplot

后端 未结 1 1748
梦如初夏
梦如初夏 2020-12-24 00:26

axis values are -6,-4,-2, 0, 2,4, 6 with some y values in a density plot. Is it possible to Add dotted vertical lines on certain x-axis values (Forex: -3 and +3 )using ggplo

相关标签:
1条回答
  • 2020-12-24 01:12

    Try geom_vline:

    ggplot(df.m) +
      geom_freqpoly(aes(x=value, y=..density.., colour=variable)) +
      geom_vline(xintercept=c(-3,3), linetype="dotted")
    

    geom_vline example

    0 讨论(0)
提交回复
热议问题