# banking: Banking In lattice: Trellis Graphics for R

 G_banking R Documentation

## Banking

### Description

Calculates banking slope

### Usage

``````banking(dx, dy)
``````

### Arguments

 `dx, dy` vector of consecutive x, y differences.

### Details

`banking` is the banking function used when `aspect = "xy"` in high level Trellis functions. It is usually not very meaningful except with `xyplot`. It considers the absolute slopes (based on `dx` and `dy`) and returns a value which when adjusted by the panel scale limits will make the median of the above absolute slopes correspond to a 45 degree line.

This function was inspired by the discussion of banking in the documentation for Trellis Graphics available at Bell Labs' website (see `Lattice`), but is most likely identical to an algorithm described by Cleveland et al (see below). It is not clear (to the author) whether this is the algorithm used in S-PLUS. Alternative banking rules, implemented as a similar function, can be used as a drop-in replacement by suitably modifying `lattice.options("banking")`.

### Author(s)

Deepayan Sarkar Deepayan.Sarkar@R-project.org

### References

Cleveland, William S. and McGill, Marylyn E. and McGill, Robert (1988) “The Shape Parameter of a Two-variable Graph”, Journal of the American Statistical Association, 83, 289–300.

`Lattice`, `xyplot`

### Examples

``````
## with and without banking

plot <- xyplot(sunspot.year ~ 1700:1988, xlab = "", type = "l",
scales = list(x = list(alternating = 2)),
main = "Yearly Sunspots")
print(plot, position = c(0, .3, 1, .9), more = TRUE)
print(update(plot, aspect = "xy", main = "", xlab = "Year"),
position = c(0, 0, 1, .3))