gg_bar_discrete: Do a simple barplot

Description Usage Arguments Value Examples

Description

Do a simple barplot

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
gg_bar_discrete(
  df,
  x,
  y,
  fill,
  xlimits,
  ymin,
  ymax,
  xlab,
  ylab,
  bar_labels = FALSE,
  flip = FALSE,
  legend = FALSE,
  legend_colors = c(none = "black", legend_label = "")
)

Arguments

df

Data frame

x

Character - Which column use for x axis (quoted variable), should correspond to a character column

y

Character - Which column use for y axis (quoted variable), should correspond to a numeric column

fill

Character - Which column use for the slices of the bar plot (quoted variable), should correspond to a character column

bar_labels

TRUE or FALSE - to add the label inside the graph itself to the bar

flip

TRUE or FALSE - to flip to horizontal mode

legend

TRUE or FALSE - if TRUE the two following items must be passed to the function, if FALSE then automatic legends

legend_colors

List - Correspondance between fill categories and colors

legend_label

Character - Title of the legend

Value

A ggplot2 object

Examples

1
2
3
4
5
6
7
p <- dv_bar_discrete (cultures_division,x="division", y="n_strains", fill="domain",
                     ymin=0, ymax=400, xlab="Division", ylab="Number of strains",
                     bar_labels=TRUE, flip=TRUE,
                     legend=TRUE,
                     legend_colors = c("deposit" = "yellow", "collaborator" = "blue",
                     "public" = "red", "education" = "green", "private"="black"),
                     legend_label = "order type")

vaulot/dvutils documentation built on Nov. 20, 2021, 11:01 a.m.