plot_bars_facet2D: Plot Bar Graph with Facet Wrap

View source: R/plot_count.R

plot_bars_facet2DR Documentation

Plot Bar Graph with Facet Wrap

Description

Plot count of 2 variables (2D) into bar graph with facet wrap.

Usage

plot_bars_facet2D(
  data,
  var,
  var_facet,
  stat = c("percent", "prop", "count"),
  label_geom = c("label", "label_repel", "text", "text_repel"),
  label_number = c("percent", "count", "both"),
  ...
)

Arguments

data

A data.frame

var

(Quoted or Unquoted) Variable to count in each facet

var_facet

(Quoted or Unquoted) Variable intended to get facet wrapped (grouping variable)

stat

(A Character) How y-axis computed ?

  • "percent": as percentage with ⁠%⁠

  • "prop": as proportion

  • "count": as count

label_geom

(A Character) Indicate function of label geom

  • "label": geom_label

  • "label_repel": ggrepel::geom_label_repel

  • "text": geom_text

  • "text_repel": ggrepel::geom_text_repel

label_number

(A Character) How to display the label?

  • "percent": use ⁠%⁠ (eg. 60%)

  • "count": count as integer (eg. 6)

  • "both": use ⁠%⁠ and count in parenthesis (eg. 60% (6))

...

Passed to selected function of label_geom

Value

A Plot class gg and ggplot

Examples

plot_bars_facet2D(mtcars, cyl, gear, color = "white")

Lightbridge-KS/lbx documentation built on Dec. 4, 2024, 2:53 a.m.