waterfall_plot: waterfall_plot

View source: R/waterfall_plot.R

waterfall_plotR Documentation

waterfall_plot

Description

function for creating waterfall charts

Usage

waterfall_plot(
  data,
  x,
  y,
  group,
  size = 11,
  labels = ez_labels,
  label_rescale = 1,
  y_min = "auto",
  rescale_y = 1.1,
  n_signif = 3,
  rotate_xlabel = FALSE,
  bottom_label = TRUE,
  ingroup_label = FALSE,
  n_x = 2,
  env = parent.frame()
)

Arguments

data

A data.frame.

x

A named character value. Evaluates to a column.

y

A named character value. Evaluates to a column.

group

A character value. Evaluates to a column.

size

theme size for use_theme(). Default is 14.

labels

Function for formatting labels.

label_rescale

Scaling factor for chart labels (relative to axis labels).

y_min

Minimum limit of y axis.

rescale_y

Rescaling factor for y-axis limits

n_signif

Number of significant figures in labels.

rotate_xlabel

Logical.

bottom_label

Logical.

ingroup_label

Logical. Shows in-group percentage change.

n_x

Number of x levels to show in chart.

env

environment for evaluating expressions.

Examples

library(tsibbledata)
waterfall_plot(aus_retail,
               "lubridate::year(Month)",
               "Turnover",
               "sub(' Territory', '\nTerritory', State)",
               rotate_xlabel = TRUE)
waterfall_plot(aus_retail,
               "lubridate::year(Month)",
               "Turnover",
               "sub(' Territory', '\nTerritory', State)",
               rotate_xlabel = TRUE,
               label_rescale = 0.5,
               ingroup_label = TRUE,
               bottom_label = FALSE,
               n_x = 3,
               size = 20,
               y_min = 0)

wkostelecki/ezplot documentation built on Feb. 1, 2024, 10:58 p.m.