Adding vertical line in plot ggplot

后端 未结 2 419
忘掉有多难
忘掉有多难 2020-12-28 11:37

I am plotting a graph using the following piece of code:

library (ggplot2)

png (filename = \"graph.png\")
stats <- read.table(\"processed-r.dat\", header         


        
2条回答
  •  隐瞒了意图╮
    2020-12-28 12:19

    You can add vertical line with geom_vline(). In your case:

    + geom_vline(xintercept=2)
    

    If you want to see also number 0.5 on your y axis, add scale_y_continuous() and set limits= and breaks=

    + scale_y_continuous(breaks=c(0.5,1,2,3,4,5),limits=c(0.5,6))
    

提交回复
热议问题