hadley/ggplot2 — Issue #270: geom_boxplot: width with continuous axis has inconsistent results
Author: wch
Created: 2011-12-02 20:30:15+00:00
State: open

I ran across this one when answering a question on the mailing list... When using `geom_boxplot` with a continuous axis and specifying the `group`, setting `width` has some inconsistent results.

When there's a single data point in a group, the box is centered on that point, with the specified width. This means that one box can actually overlap with another even with the specified width is the same or smaller than the group size, as in the example.

When there is more than one point, the width of the box is slightly less (0.8?) than the width of the actual data in the group.

```R
set.seed(113)
dat <- data.frame(x=rnorm(50)^2, y= rnorm(50))

ggplot(dat,aes(x=x,y=y)) +
geom_boxplot(aes(group=floor(x)), width=1) +
geom_point(shape=21, colour="blue") # Distinguish these points from boxplot outliers
```

I'm not sure what the expected behavior should be, so I can't provide a test.