# waterfallchart {waterfall}

### Description

Creates a waterfall chart using the 'Lattice' package.

### Usage

waterfallchart(x, data, ...) ## S3 method for class 'formula': waterfallchart((x, data=NULL, groups=NULL, horizontal=FALSE, panel=lattice.getOption("panel.waterfallchart"), prepanel=lattice.getOption("prepanel.waterfallchart"), box.ratio=2, origin = 0, level.lines=TRUE, ...))

### Arguments

- x
- a formula describing the form of conditioning plot. The formula is generally of the form 'y ~ x | g1 * g2 * ...', indicating that plots of 'y' (on the y axis) versus 'x' (on the x axis) should be produced conditional on the variables 'g1, g2, ...'. However, the conditioning variables 'g1,g2,...' may be omitted.
- data
- a data frame containing values (or more precisely, anything that is a valid 'envir' argument in 'eval', e.g., a list or an environment) for any variables in the formula, as well as 'groups' and 'subset' if applicable. If not found in 'data', or if 'data' is unspecified, the variables are looked for in the environment of the formula.
- groups
- a variable or expression to be evaluated in the data frame specified by 'data', expected to act as a grouping variable within each panel, typically used to distinguish different groups by varying graphical parameters like color and line type. Unlike with the barchart function, groups specifies where subtotals columns, should appear. There is a subtotal created for each group specified. If no groups are given, a summary column is still reported.
- horizontal
- This argument is used to process the arguments to these high level functions, but more importantly, it is passed as an argument to the panel function, which is supposed to use it as appropriate.
- panel
- This draws the actual plot after bwplot has done the difficult work of processing the formula.
- prepanel
- This function returns the bwplot information on the number of columns to display and where to place labels.
- box.ratio
- specifies the ratio of the width of the rectangles to the interrectangle space.
- origin
- initial offset relative to the x axis. The value serves as the logical starting point for the first column and any summary column. Defaults to 0.
- level.lines
- if FALSE, the lines connecting adjacent boxes are ommitted from the display.
- ...
- further arguments

### Details

This function closely mimics the barchart interface, but provides a type of chart called a waterfall plot, showing how multiple subvalues contribute to a total sum. The bulk of the work is actually processed in bwplot which defines where tickmarks and other information outside the plot itself are placed. Only a formula method is provided.

Matrix and vector interfaces are not provided because mimicing the behavior of barchart for those interfaces produces unintellible and undefined graphic output.

### References

James P. Howard, II, FIXME. Andrew Jaquith, *Security Metrics: Replacing Fear, Uncertainty, and Doubt* (Boston: Addison-Wesley Professional, 2007), 170-172. Ethan M. Rasiel, *The McKinsey Way: Using the Techniques of the World's Top Strategic Consultants to Help You and Your Business* (New York: McGraw-Hill, 1999), 113-118.

### See Also

`barchart`

, `waterfallplot`

### Examples

Documentation reproduced from package waterfall, version 0.9.9.20121030. License: BSD