hadley/ggplot2 — Issue #274: Automatic y range with geom_boxplot doesn't include outliers
Author: wch
Created: 2011-12-04 08:11:52+00:00
State: open

This example should include the range -8000 to 8000, but it only goes from about -4000 to 4000. This is enough to include the whiskers but not the outliers.

```R
dat <- data.frame(x=1, y=c(-(1:20)^3, (1:20)^3) )
ggplot(dat, aes(x,y)) + geom_boxplot()
```

Test code:

```R
test_that("geom_boxplot range includes all outliers", {
dat <- data.frame(x=1, y=c(-(1:20)^3, (1:20)^3) )
p <- ggplot_build(ggplot(dat, aes(x,y)) + geom_boxplot())

expect_true(p$panel$ranges[[1]]$y.range[1] < min(dat$y))
expect_true(p$panel$ranges[[1]]$y.range[2] > max(dat$y))
})
```