Examples for 'GGally::ggally_colbar'


Column and row bar plots

Aliases: ggally_colbar ggally_rowbar

Keywords: hplot

### ** Examples

# Small function to display plots only if it's interactive
p_ <- GGally::print_if_interactive

data(tips, package = "reshape")
p_(ggally_colbar(tips, mapping = aes(x = smoker, y = sex)))
plot of chunk example-GGally-ggally_colbar-1
p_(ggally_rowbar(tips, mapping = aes(x = smoker, y = sex)))
plot of chunk example-GGally-ggally_colbar-1
# change labels' size
p_(ggally_colbar(tips, mapping = aes(x = smoker, y = sex), size = 8))
plot of chunk example-GGally-ggally_colbar-1
# change labels' colour and use bold
p_(ggally_colbar(tips, mapping = aes(x = smoker, y = sex),
              colour = "white", fontface = "bold"))
plot of chunk example-GGally-ggally_colbar-1
# display number of observations instead of proportions
p_(ggally_colbar(tips, mapping = aes(x = smoker, y = sex, label = after_stat(count))))
plot of chunk example-GGally-ggally_colbar-1
# custom bar width
p_(ggally_colbar(tips, mapping = aes(x = smoker, y = sex), geom_bar_args = list(width = .5)))
plot of chunk example-GGally-ggally_colbar-1
# change format of labels
p_(ggally_colbar(tips, mapping = aes(x = smoker, y = sex),
              label_format = scales::label_percent(accuracy = .01, decimal.mark = ",")))
plot of chunk example-GGally-ggally_colbar-1
p_(ggduo(
  data = as.data.frame(Titanic),
  mapping = aes(weight = Freq),
  columnsX = "Survived",
  columnsY = c("Sex", "Class", "Age"),
  types = list(discrete = "rowbar"),
  legend = 1
))
plot of chunk example-GGally-ggally_colbar-1

[Package GGally version 2.1.2 Index]