daattali / ggExtra

📊 Add marginal histograms to ggplot2, and more ggplot2 enhancements

Home Page:http://daattali.com/shiny/ggExtra-ggMarginal-demo/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ggMarginal grouped boxplots are different widths

nathanieldelaneybusch opened this issue · 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