Plot a bar plot
plot_barplot.Rd
This function plots a barplot with ggplot.
Usage
plot_barplot(
df,
x = NULL,
y = NULL,
fill = NULL,
pattern = NULL,
pattern_density = 0.001,
pattern_spacing = 0.015,
pattern_key_scale_factor = 0.8,
pattern_color = "black",
pattern_bg_legend = "white",
pattern_type = c("none", "stripe", "stripe", "stripe", "stripe", "circle"),
pattern_angle = c(0, 50, -50, 0, 90, 0),
position = ggplot2::position_fill
)
Arguments
- df
DATAFRAME : a long dataframe containing information to plot (no default)
- x
CHARACTER : a column of df to split the barplot by (default to NULL)
- y
CHARACTER : a column of df representing the quantity of x (default to NULL)
- fill
CHARACTER : a column of df to fill (x,y) bars by (default to NULL)
- pattern
CHARACTER : a column of df to pattern (x,y) bars by (default to NULL)
- pattern_density
NUMERIC : (from ggpattern::geom_col_pattern function) approximate fill fraction of the pattern (default to 0.001)
- pattern_spacing
NUMERIC : (from ggpattern::geom_col_pattern function) spacing of the pattern as a fraction of the plot size (default to 0.015)
- pattern_key_scale_factor
NUMERIC : (from ggpattern::geom_col_pattern function) for the pattern legend (default to 0.8)
- pattern_color
CHARACTER : pattern color (default to "black")
- pattern_bg_legend
CHARACTER : color for the legend background, behind pattern (default to "white")
- pattern_type
VECTOR : a character vector containing patterns for each level of the pattern column (default to c("none", "stripe", "stripe", "stripe", "stripe", "circle"))
- pattern_angle
VECTOR : a numeric vector containing angles associated to each pattern in pattern_type (default to c(0, 50, -50, 0, 90, 0))
- position
FUNCTION : position adjustment, either as a string, or the result of a call to a position adjustment function. This parameter will be passed to the ggplot2::geom_bar position parameter. For example, it is supposed to be one of : position_stack or position_fill or position_dodge (default to position_fill)