Explore categorical columns with bar charts
Installation
Development version from GitHub:
GitHub: https://github.com/zpio/ggexplorer
Show/Hide code
::install_github("zpio/ggexplorer") remotes
Show/Hide code
library(ggexplorer)
Examples
Diamonds dataset
Show/Hide code
::diamonds ggplot2
Basic Chart
Show/Hide code
plotBar(ggplot2::diamonds)
Fill
Show/Hide code
plotBar(ggplot2::diamonds, fill = "steelblue")
Pct
Show/Hide code
plotBar(ggplot2::diamonds, pct = TRUE)
Top
Show/Hide code
plotBar(ggplot2::diamonds, fill = "steelblue", top = 3)
Number of facet columns
Show/Hide code
plotBar(ggplot2::diamonds, fill = "steelblue", top = 5, ncol = 2)
Fill by
Show/Hide code
plotBar(ggplot2::diamonds, fill_var = cut)
Legend Position
Show/Hide code
plotBar(ggplot2::diamonds, fill_var = cut, legend_position = "bottom")
Position
Show/Hide code
plotBar(ggplot2::diamonds, fill_var = cut, position = "stack")
Show/Hide code
plotBar(ggplot2::diamonds, fill_var = cut, position = "dodge")
Show/Hide code
plotBar(ggplot2::diamonds, fill_var = cut, position = "fill")
Colour scales
Show/Hide code
plotBar(ggplot2::diamonds, fill_var = cut) +
::scale_fill_hue() ggplot2
Interactive
Show/Hide code
plotBar(ggplot2::diamonds, fill_var = cut, position = "stack",
interactive = TRUE)