set upper limit in ggplot to include label greater than the maximum value

后端 未结 5 938

My data range always seems to be greater than the top label in the y-axis. Is there a way I can automatically include it without manually setting limits?

e.g. in

5条回答
  •  眼角桃花
    2020-12-16 02:27

    Have you tried skipping the 0.95 * 1.05 multipliers?

    expand_limits(y=c(min(pretty(c(dat$y,min(dat$y)))),max(pretty(c(dat$y,max(dat$y))))))
    

提交回复
热议问题