ggplot2 Force y-axis to start at origin and float y-axis upper limit

后端 未结 2 816
-上瘾入骨i
-上瘾入骨i 2020-12-11 16:13

After a bit of searching I am still not happy!

Is there a simple way to make a graph with a y-axis that starts at the origin and clearly shows all your data?

<
2条回答
  •  感情败类
    2020-12-11 16:53

    Why not just:

    ggplot(my.data, aes(x.var, y.var))+
        geom_point()+
        scale_y_continuous(expand = c(0,0))+
        expand_limits(y = c(0,1.05 * max(my.data$y.var)))
    

提交回复
热议问题