Plot a bar plot using ggplot2.

horisontal_bar_plot(
  df,
  x_var,
  fill_var,
  title = NULL,
  subtitle = NULL,
  y_lab = NULL,
  x_lab = NULL,
  fill_colors = NULL,
  percent_accuracy = 1,
  ...
)

Arguments

df

Data frame.

x_var

Variable for x axis, use string name. Recommended that x_var is in character in df.

fill_var

Variable for the different colors in bars, use string name. Use NULL if only one color for bars.

title

Plot title, NULL if no title.

subtitle

Small text under title, NULL if no subtitle.

y_lab

Y-axis label, use NULL for no label.

x_lab

X-axis label, use NULL for no label.

fill_colors

Color of the different categories in fill_var.

percent_accuracy

Set accuracy for scales::percent_format().

...

arguments passed to theme_slr()

Value

              ggplot object containing bar plot.