Hi everyone -
Someone just asked me a question about changing the y-min on a bar graph. When you use ylim() or scale_y_continuous(limits=xxx), of course, the bars disappear. The usual answer is to use coord_cartesian(ylim=xxx) instead.
I discovered that you can also use scale_y_continuous(limits=xxx, oob=rescale_none). Is this considered an OK way to do it? I find that the coord/scale limits thing is not very intuitive for ggplot2 users (including me sometimes!)
dat <- data.frame(x=c("A","B"), y=c(10,12))
p <- ggplot(data=dat, aes(x=x, y=y)) + geom_bar()
# Normal version
p
# No visible bars
p + scale_y_continuous(limits=c(5, 15))
# Visible bars with oob=rescale_none
p + scale_y_continuous(limits=c(5, 15), oob=rescale_none)
# Visible bars with coord_cartesian
p + coord_cartesian(ylim=c(5,15))
-Winston