I would like to be able to map the width of each of the boxplots in a plot to a variable, or otherwise specify it. Let's say I want the relative widths of the boxes in the figure below to be 1, 2, 3. Setting varwidth
won't help me since the actual numbers of observations are the same for each bar.
I have the beginnings of a horrible hacky solution I can post, but would welcome something actually good!
library(ggplot2)
set.seed(101)
dd <- data.frame(f = factor(rep(LETTERS[1:3], each = 10)),
y = rnorm(30))
g1 <- ggplot(dd, aes(f,y)) + geom_boxplot()
print(g1)