Learn R Programming

waterfall (version 0.9.9.20100522)

waterfallchart: Waterfall Charts in R using Lattice

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, ...)

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,
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', o
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.
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.
...
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

Run this code
data(rasiel)
data(jaquith)
waterfallchart(value~label, data=rasiel, groups=subtotal)
waterfallchart(factor~score, data=jaquith)

Run the code above in your browser using DataLab