It's a bit hard to see what's going wrong here. Adding some more
information and tweaking values makes things a bit easier:
df <- data.frame(x = 1,y = c(50,100,150))
ggplot(df,aes(x,y)) +
geom_point() +
stat_summary(fun.y=mean, geom="point", color = "red") +
scale_y_log10()
Why doesn't the red dot lie at 10^2? Well, the scale transformation
occurs before the statistical transformation - so we're computing the
mean of the log transformed values:
> mean(log10(c(50, 100, 150)))
[1] 1.958354
It works this way because the basic idea is that these two plots
should appear identical (apart from the labels on the scale):
ggplot(df,aes(x,y)) +
geom_point() +
stat_summary(fun.y=mean, geom="point", color = "red") +
scale_y_log10()
and
ggplot(df,aes(x, log10(y))) +
geom_point() +
stat_summary(fun.y=mean, geom="point", color = "red")
Does that help?
Hadley
--
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
http://had.co.nz/