0
votes

Basically like this question:

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

The issue I have with the solution and ggplot2 it seems that it overdraws. I want limits = c(1,1e8) I do not want the tiny bit additional space below and above this limits. See below:

wrong limits

I want the limits to be at the edge of the graph and 0 additional space. How do I achieve that?

2

2 Answers

1
votes
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

4
votes

Try:

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

although personally, I think the extra spacing serves a purpose.