plot_bar: plot_bar

View source: R/visualization.R

plot_barR Documentation

plot_bar

Description

Create a bar plot using the aelab theme.

Usage

plot_bar(
  df,
  x,
  y,
  z = NULL,
  base_size = 25,
  line_width = 1,
  text_color = "black",
  facet = FALSE,
  facet_x = NULL,
  facet_y = NULL,
  style = "bw",
  position = "dodge",
  stat = "identity"
)

Arguments

df

A data frame.

x

<['data-masking'][ggplot2::aes]> Column mapped to the x-axis.

y

<['data-masking'][ggplot2::aes]> Column mapped to the y-axis.

z

<['data-masking'][ggplot2::aes]> Optional column mapped to fill colour.

base_size

Base font size. Default 25.

line_width

Bar outline width. Default 1.

text_color

Text colour. Default "black".

facet

Logical; add facet grid? Default FALSE.

facet_x

Column name (string) for the horizontal facet dimension.

facet_y

Column name (string) for the vertical facet dimension.

style

Theme style. Default "bw".

position

Bar position: "dodge" or "stack". Default "dodge".

stat

Stat type: "identity" or "count". Default "identity".

Value

A ggplot object.

Examples

## Not run: 
df <- data.frame(x = c("A","B","A","B"), g = c("X","X","Y","Y"), y = c(1,2,3,4))
plot_bar(df, x, y, g)

## End(Not run)

aelab documentation built on Feb. 23, 2026, 5:07 p.m.