# NOT RUN {
gf_barh(~Diet, data = ChickWeight)
gf_bar(Diet ~ ., data = ChickWeight, orientation = 'y' )
gf_barh(~substance, data = mosaicData::HELPrct, fill = ~sex)
gf_bar(substance ~ ., data = mosaicData::HELPrct, fill = ~sex, orientation = 'y')
gf_barh(~substance,
data = mosaicData::HELPrct, fill = ~sex,
position = position_dodgev()
)
# gf_countsh() is another name for gf_barh()
gf_countsh(~Diet, data = ChickWeight)
# gf_propsh() and gf_percentsh() use proportions or percentages instead of counts
gf_propsh(substance ~ ., data = mosaicData::HELPrct, fill = ~sex,
position = position_dodgev())
gf_props(substance ~ ., data = mosaicData::HELPrct, fill = ~sex,
position = position_dodge(), orientation = 'y')
gf_props(~substance, data = mosaicData::HELPrct, fill = ~sex,
position = position_dodge())
gf_percents(~substance, data = mosaicData::HELPrct, fill = ~sex,
position = position_dodge())
if (require(scales)) {
gf_props(~substance, data = mosaicData::HELPrct, fill = ~sex,
position = position_dodge()) %>%
gf_refine(scale_y_continuous(labels = scales::percent))
}
# }
Run the code above in your browser using DataLab