The easiest way to achieve what you ask for, with automatic limits and interruptions and no side effects:
library(ggplot2) library(MASS) library(scales) ggplot(data=subset(movies, votes > 1000)) + aes(x = rating, y = votes / 10000) + scale_y_log10(breaks = trans_breaks("log10", function(x) 10^x, n=3), labels = trans_format("log10")) + geom_point()
I prefer to use superscripts for powers of ten, and hide the minor grid, and add ticks located at a distance according to the logs. It is also quite easy to achieve:
ggplot(data=subset(movies, votes > 1000)) + aes(x = rating, y = votes / 10000) + scale_y_log10(breaks = trans_breaks("log10", function(x) 10^x, n=3), labels = trans_format("log10", math_format(10^.x))) + theme(panel.grid.minor = element_blank()) + annotation_logticks(sides="l") + geom_point()
The above code is in the help examples annotation_logticks, annotation_logticks . There is a lot of flexibility for setting the exact format.
Pedro Aphalo Sep 04 '13 at 8:21 2013-09-04 08:21
source share