geom_boxplot: width with continuous axis has inconsistent results #270

wch opened this Issue Dec 2, 2011 · 1 comment


None yet
2 participants

wch commented Dec 2, 2011

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.

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.


hadley commented Feb 24, 2014

This sounds like a great feature, but unfortunately we don't currently have the development bandwidth to support it. If you'd like to submit a pull request that implements this feature, please follow the instructions in the development vignette.

hadley closed this Feb 24, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment