I just noticed how ggplot is removing datapoints when the scale_y_continuous is limited so that certain values are not included. Example:
library("ggplot2")
exdf <- mtcars
ggp <- ggplot(data=exdf, mapping=aes(x=cyl, y=disp)) +
stat_summary(fun.y="mean", geom="point", size=4) +
scale_y_continuous(limits=c(1, 400))
ggp
#compare to:
range(exdf$disp)
ggp <- ggplot(data=exdf, mapping=aes(x=cyl, y=disp)) +
stat_summary(fun.y="mean", geom="point", size=4) +
scale_y_continuous(limits=c(1, 500))
ggp
All three dots are displayed and are not limited by the range, but the underlying data-range is limited. Note the messages about "rows containing non-finite values". I find this behavior odd and wonder if there might be a workaround?