Description Usage Arguments Details Value Author(s) Examples
Create a bar chart based on ggplot.
1 2 3 4 5 6 7 | bars(data, count, group, highlight_variable = NA,
ordered = "alphabetically", first_group = NA, flipped = TRUE,
labelled = FALSE, show_percent = NA, label_nudge_y = -0.02 *
max(select(data, { { count } })), label_nudge_x = 0,
label_size = 3, label_color = "white", label_hjust = "right",
axis.title.x = element_blank(), axis.title.y = element_blank(),
title = element_blank(), legend.position = "none", fontsize = 16)
|
data |
A data frame. |
count |
The variable that contains the number of observations per group. |
group |
The groups that are displayed as separate bars. |
highlight_variable |
Default NA, indicate variable that is TRUE only for the highlighted group. |
ordered |
Default alphabetically, alternative is count, then ordered in descending order. |
first_group |
Default NA, indicate a group which should be displayed first (left or top). |
flipped |
Default TRUE. If flipped is TRUE bars are horizontally (groups on y axis), otherwise bars are vertically (groups on x axis). |
Use ggplot's geom_col geom to create bar charts that are visually appealing and in line with a common theme and visualization style.
A ggplot style bar graph.
Philipp Kollenda
1 2 3 4 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.