library(ggplot2)
# ggplot dodge
ggplot(mpg, aes(class)) +
geom_bar(aes(fill = drv),
position = position_dodge(preserve = "single"))
# normal dodge without nesting
ggplot(uncertain_mpg, aes(class)) +
geom_bar_sample(aes(fill = drv), position = "dodge")
# dodge_identity
ggplot(uncertain_mpg, aes(class)) +
geom_bar_sample(aes(fill = drv), position = "dodge_identity", alpha=0.2)
# dodge_dodge
ggplot(uncertain_mpg, aes(class)) +
geom_bar_sample(aes(fill = drv), position = "dodge_dodge")
# identity_dodge
ggplot(mpg, aes(class)) +
geom_bar(aes(fill = drv), alpha=0.5, position = "identity")
ggplot(uncertain_mpg, aes(class)) +
geom_bar_sample(aes(fill = drv), position = "identity_dodge", alpha=0.7)
Run the code above in your browser using DataLab