Closed
Description
I want to plot a geom without with together with a geom that does have width, e.g. points and boxplots.
Not all factor combinations are present.
The default of adjusting the width (preserve = 'total'
) works fine. But when maintaining the box widths with preserve = 'single'
I can no longer do the same for the points.
library(ggplot2)
ggplot(mtcars, aes(factor(gear), mpg, fill = factor(am))) +
geom_boxplot(position = position_dodge(preserve = 'total')) +
geom_point(position = position_dodge(0.75, preserve = 'total'))
ggplot(mtcars, aes(factor(gear), mpg, fill = factor(am))) +
geom_boxplot(position = position_dodge(preserve = 'single')) +
geom_point(position = position_dodge(0.75, preserve = 'total'))
ggplot(mtcars, aes(factor(gear), mpg, fill = factor(am))) +
geom_boxplot(position = position_dodge(preserve = 'single')) +
geom_point(position = position_dodge(0.75, preserve = 'single'))
#> Warning in max(table(panel$xmin)): no non-missing arguments to max;
#> returning -Inf
Created on 2018-06-24 by the reprex package (v0.2.0).
Metadata
Metadata
Assignees
Labels
No labels