ggplot2:log10-scale和轴限制

时间:2017-05-02 06:34:46

标签: r ggplot2

基本上就像这个问题:

How can I set axis ranges in ggplot2 when using a log scale?

我对解决方案和ggplot2的问题似乎是透支了。我想要limits = c(1,1e8)我不希望在此限制之下的微小额外空间。见下文:

wrong limits

我希望限制位于图形的边缘和0个额外的空间。我如何实现这一目标?

2 个答案:

答案 0 :(得分:4)

尝试:

+ scale_y_log10(limits = c(1, 1e8), expand = c(0, 0))

虽然我个人认为,额外的间距是有目的的。

答案 1 :(得分:1)

ggplot(data = df,aes(x = x, y =y)) + 
  geom_point() + 
  scale_y_log10(limits = c(1,1e8), expand = c(0, 0))

enter image description here