# NOT RUN {
gf_boxploth(sex ~ age, data = mosaicData::HELPrct, varwidth = TRUE)
gf_boxplot(sex ~ age, data = mosaicData::HELPrct, varwidth = TRUE, orientation = 'y')
gf_boxploth(substance ~ age, data = mosaicData::HELPrct, color = ~sex)
# move boxplots away a bit by adjusting dodge
gf_boxploth(substance ~ age,
data = mosaicData::HELPrct, color = ~sex,
position = position_dodgev(height = 0.9)
)
# gf_boxplot guesses horizontal because substance is categorical
gf_boxplot(substance ~ age,
data = mosaicData::HELPrct, color = ~sex,
position = position_dodge(width = 0.9)
)
gf_boxploth(substance ~ age, data = mosaicData::HELPrct, color = ~sex, outlier.color = "gray50")
# longer whiskers
gf_boxploth(substance ~ age, data = mosaicData::HELPrct, color = ~sex, coef = 2)
# Note: height for boxplots is full width of box.
# For jittering, it is the half-height.
gf_boxploth(substance ~ age | sex, data = mosaicData::HELPrct, coef = 5, height = 0.4) %>%
gf_jitter(height = 0.2, alpha = 0.3)
# combining boxplots and histograms
gf_histogram(~eruptions, data = faithful) %>%
gf_boxploth(0 ~ eruptions, alpha = 0, width = 2)
gf_histogram(~eruptions, data = faithful) %>%
gf_boxploth(-2 ~ eruptions, alpha = 0, width = 2)
gf_histogram(~eruptions, data = faithful) %>%
gf_boxploth(32 ~ eruptions, alpha = 0, width = 2)
# }
Run the code above in your browser using DataLab