rp.colour.key {rpanel} | R Documentation

## Creates a colour key.

### Description

A colour key is created using the specified colours (`cols`) and an axis defined by the specified breaks (`brks`). This is usually an additional component of a panel which allows the colours on the main plot to be interpreted. The function is used in that way in the function `rp.plot4d`.

### Usage

    rp.colour.key(cols, brks, par.mar = c(5, 0, 4, 3) + 0.1, natural = TRUE, margin = FALSE)

### Arguments

`cols` | a vector of colours.
`brks` | a vector of values which defines the positions on the axis between which each colour is placed.
`par.mar` | a vector of four values which are passed to the `mar` argument of the `par` function to control the marginal space arond the key.
`natural` | a logical value which, when `TRUE`, causes the usual form of axis to be constructed from the values in `brks`. When `natural` is `FALSE`, the values in `brks` are associated with a regularly spaced set of locations along the axis.

`margin`

a logical value which determines whether a marginal plotting area is placed on the left of the key. This can be useful in allowing relevant information to be plotted alongside teh key, suchas the confidence intervals in `rp.surface`. Specifically, if `margin` is `FALSE`, the horizontal axis has range `c(0, 1)` while if `margin` is `TRUE` the the range is `c(-1, 1)`. In both cases the key is plotted over the horizontal range `c(0, 1)`.

### References

rpanel: Simple interactive controls for R functions using the tcltk package. Journal of Statistical Software, 17, issue 9.

### Examples

    ## Not run:
      key.plot <- function(panel) {
      	rp.colour.key(topo.colors(12), 0:12)
      	panel
      }
      panel <- rp.control()
      rp.tkrplot(panel, key, key.plot, hscale = 0.15)

    ## End(Not run)

[Package rpanel version 1.1-4 Index]