plot_waterfall: Waterfall plot

Description Usage Arguments

Description

Produce a waterfall plot using the geom_rect() function. A waterfall plot shows a sequence of numbers as an increase or decrease from the cumulative sum of the previous numbers. It is useful in breaking out a change in values into components and comparing the relative size and direction of each component. For an example, see: https://learnr.wordpress.com/2010/05/10/ggplot2-waterfall-charts/

Usage

1
2
3
4
5
6
plot_waterfall(data, x, y, group = NULL, group_sign = FALSE,
  anchor = NULL, anchor.first = TRUE, anchor.last = TRUE,
  palette = c("green", "red", "blue4"), title = NULL, subtitle = NULL,
  width = 0.8, xlab = NULL, ylab = NULL, x.rotate = 0,
  linetype = "dashed", linecolor = "black", border = "black",
  legend.position = "none")

Arguments

data

('data.frame' | 'tibble') Data to be used in plot

x

Variable to use on X-axis. Must be of type 'character' or 'factor'.

y

Variable to use on Y-axis. Must be of type 'numeric' or 'integer'.

group

(Optional) Variable to group by

group_sign

('logical') (Optional) Group by sign (positive or negative) for each segment? A new column will be created consisting of 'pos', 'neg', 'anchor' for each segment (factor levels will be set in order listed). If 'TRUE', will override 'group'. Default is 'FALSE'.

anchor

(Optional) Vector of x values or numerical indices which will touch the X-axis.

anchor.first

(Optional) Anchor the first segment of the waterfall? Default is TRUE.

anchor.last

(Optional) Anchor the last segment of the waterfall? Default is TRUE.

palette

(Optional) Color palette to use for fill. Default is c('blue4', 'red', 'green').

title

(Optional) Plot title

subtitle

(Optional) Plot subtitle

width

(Optional) Width of segments, expressed as a number between 0 and 1, with 0 meaning segments will not be shown, and 1 meaning segments will be touching each other. Default is 0.8.

xlab

(Optional) Axis label for x-axis

ylab

(Optional) Axis label for y-axis

x.rotate

(Optional) Degrees to rotate x-axis labels. Default is 0. Will be passed to ggplot2::theme(axis.text.x = element_text(angle = )).

linetype

(Optional) Type of line to use to connect waterfall segments. Default is 'dashed'. Will be passed to ggplot2::geom_step(linetype = ).

linecolor

(Optional) Color of line used to connect waterfall segments. Default is 'black'. Will be passed to ggplot2::geom_step(color = ).

border

(Optional) Color of border to use for waterfall segments. Default is 'black'. Will be passed to ggplot2::geom_rect(color = ).

legend.position

(Optional) Where to show the legend for the fill colors. Default is 'none'. Will be passed to ggplot2::theme(legend.position = ).


Prometheus77/ezplot documentation built on May 26, 2019, 3:35 p.m.