I have a time series of data where the measurements are all integers between 1e6 and 1e8: website hits per month. I want to use ggplot2 to chart these with points and lines, but mapping the measurements to a log scale. Something like this:
qplot(month, hits, data=hits.per.month, log="y")
When I do that, ggplot seems to set the scale from 1e6 to 1e8. I want it to scale from 0 to 1e8. The natural way of doing this seems to have no affect on the output:
qplot(month, hits, data=hits.per.month, log="y", ylim=c(0, 100000000))
I can get the picture I want by transforming hits before it reaches qplot, but that changes the labels on the axis:
qplot(month, log10(hits), data=hits.per.month, log="y", ylim=c(0, 8))
I also tried various combinations with scale_y_log10
, but had no luck.
So, how do I set the Y axis range when using a log scale in ggplot2?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…