Skip to contents

Helper function to column_bar_charts

Usage

generic_column_bar(
  t,
  category_var,
  numeric_var,
  fill,
  pos = "dodge",
  est = NULL,
  moe = NULL,
  dform = "%Y",
  title = NULL,
  subtitle = NULL,
  source = "",
  alt = NULL,
  category_label = NULL,
  numeric_label = NULL,
  column_vs_bar = "column",
  dec = 0,
  color = "pgnobgy_5",
  interactive = FALSE
)

Arguments

t

A tibble in long form for plotting

category_var

The name of the category variable

numeric_var

The name of the variable with numeric values to plot

fill

The name of the variable you want the fill color of the bars to be based on

pos

Determines if the bars are side-by-side(dodge) or stacked(stack) - defaults to "dodge"

est

Type for the numeric values - enter "percent", "currency" or "number", defaults to "percent"

moe

The name of the variable to be used for error bars, if desired - default is "NULL"

dform

Format for Date values

title

Title to be used for chart, if desired - defaults to "NULL"

subtitle

Sub-title to be used for chart, if desired - defaults to "NULL"

source

Source reference as character string, if desired - defaults to blank

alt

Text to be used for alt-text, if desired - defaults to "NULL"

category_label

category-axis title to be used for chart, if desired - defaults to "NULL"

numeric_label

numeric-axis title to be used for chart, if desired - defaults to "NULL"

column_vs_bar

"column": vertical bars or "bar": horizontal bars - defaults to "column"

dec

Number of decimal points in labels - defaults to 0

color

Name of color palette to use - generally defaults to "pgnobgy_5"

interactive

Enable hover text and other interactive features - defaults to FALSE

Value

static or interactive column or bar chart

Author

Craig Helmann, Michael Jensen