# Standard ggplots often have a position adjustment to fix overplotting
# plot with overplotting
library(ggplot2)
ggplot(mpg, aes(class)) +
geom_bar(aes(fill = drv),
position = "stack")
# normal stack warps the scale and doesn't communicate useful info
ggplot(uncertain_mpg, aes(class)) +
geom_bar_sample(aes(fill = drv), position = "stack")
# stack_identity
ggplot(uncertain_mpg, aes(class)) +
geom_bar_sample(aes(fill = drv), position = "stack_identity", alpha=0.2)
# stack_dodge
ggplot(uncertain_mpg, aes(class)) +
geom_bar_sample(aes(fill = drv), position = "stack_dodge")
Run the code above in your browser using DataLab