Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

doLegend

A simple legend


Description

Add a simple legend in form of a color bar to a plot.

Usage

doLegend(breaks, col, side)

Arguments

breaks

a vector of breaks defining a set of intervals for the data

col

a vector of colors corresponding to the intervals.

side

integer between 1 and 4, indicating on which side of the main plot the legend is supposed to be drawn. Standard interpretation: 1 = below, continuing clock-wise.

Details

This is an extremely simple way of giving a visual impression of what numerical values correspond to a given color. The actual plot is done via a call to image and axis.

Value

The locations of the ticks returned by the call to axis

See Also

Examples

## Set up data
    doLegend(1:9, g2r.colors(8), 2)

Heatplus

Heatmaps with row and/or column covariates and colored clusters

v2.36.0
GPL (>= 2)
Authors
Alexander Ploner <Alexander.Ploner@ki.se>
Initial release
2015-09-03

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.