I found a rather confusing function in ggplot when trying to annotate segments on a log10 scale. The following code creates the graph below:
library(ggplot2) dat <- data.frame(x = x <- 1:1000, y = log(x)) ggplot(dat, aes(x = x, y = y)) + geom_line(size = 2) + scale_x_log10() + annotate("segment", x = 0, xend = log10(100), y = log(100), yend = log(100), linetype = 2) + annotate("segment", x = log10(100), xend = log10(100), y = 0, yend = log(100), linetype = 2)

While this is what I get after:
ggplot(dat, aes(x = x, y = y)) + geom_line(size = 2) + scale_x_log10() + annotate("segment", x = 0, xend = log10(100), y = log(100), yend = log(100), linetype = 2) + annotate("segment", x = 100, xend = log10(100), y = 0, yend = log(100), linetype = 2)

In other words, I have to log10 convert the endpoint of the segment along the x axis, but not to the beginning. Does this behavior have a logical explanation? I understand that aes() does the conversion ... but in this case, the x-axis transforms should be the same (well, log10), right?
I am working on:
R version 3.0.0 (2013-04-03) Platform: x86_64-w64-mingw32/x64 (64-bit) ggplot2_0.9.3.1