daattali/ggExtra

ggMarginal grouped boxplots are different widths

nathanieldelaneybusch opened this issue · 2 comments

Marginal boxplots colored by groups produce boxes of different widths. Using params lists (e.g. xparams = list(varwidth = FALSE)) does not appear to fix the issue.

Example:

scatterplotMPG = ggplot( data=mpg, aes(x=cty, y = hwy)) +
  geom_point(data=mpg[mpg$drv%in%c('r', 'f'), ], aes(color=factor(drv)), alpha=0.5) +
  geom_point(data=mpg[mpg$drv%in%c('4'), ], color='gray', alpha=0.3)+
  theme(legend.position = "bottom")

ggExtra::ggMarginal(scatterplotMPG, type = "boxplot",
                    groupFill = TRUE, groupColour = TRUE, size=7,
                    xparams = list(varwidth = FALSE),
                    yparams = list(varwidth = FALSE))

image

I am using ggExtra 0.10.0 and ggplot2 3.3.5 on a windows machine.

Hey @nathanieldelaneybusch , sorry for the delay, and thanks for the reproducible example. I'll open up a PR soon with a fix.

fixed with #173 -- thanks to @crew102