createColorBar {cydar} | R Documentation

## Create a color bar

### Description

A convenience function to create a color bar on the current graphics device.

### Usage

    createColorBar(colors, top.text=NULL, bottom.text=NULL,
        lower=-0.5, upper=0.5, x.pos=0, width=1, cex=1.5)

### Arguments

`colors` | A character vector of colors to be used in successive steps of the color bar, from bottom to top.
`top.text` | String containing the label to be placed at the top of the color bar.
`bottom.text` | String containing the label to be placed at the bottom of the color bar.
`lower` | Numeric scalar specifying the bottom y-coordinate of the color bar.
`upper` | Numeric scalar specifying the top y-coordinate of the color bar.
`x.pos` | Numeric scalar specifying the x-coordinate of the middle of the color bar.
`width` | Numeric scalar specifying the width of the color bar.
`cex` | Numeric scalar specifying the size of the text.

### Details

If `bottom.text` or `top.text` are not specified, they will be take from the first and last names of `colors`, respectively. If no names are available, no labels will be created.

### Value

A color bar is created on the current graphics device. `NULL` is invisibly returned.

### Author(s)

Aaron Lun

### Examples

    plot(0,0, axes=FALSE, xlab="", ylab="")
    createColorBar(heat.colors(100), "High", "Low")

[Package cydar version 1.18.0 Index]