heat_legend {IMIFA} | R Documentation |
Add a colour key legend to heatmap plots
Description
Using only base graphics, this function appends a colour key legend for heatmaps produced by, for instance, plot_cols
or image
.
Usage
heat_legend(data,
cols = NULL,
breaks = NULL,
cex.lab = 1,
...)
Arguments
data |
Either the data with which the heatmap was created or a vector containing its minimum and maximum values. Missing values are ignored. |
cols |
The colour palette used when the heatmap was created. By default, the same |
breaks |
Optional argument giving the break-points for the axis labels. |
cex.lab |
Magnification of axis annotation, indicating the amount by which plotting text and symbols should be scaled relative to the default of 1. |
... |
Catches unused arguments. |
Value
Modifies an existing plot by adding a colour key legend.
See Also
image
, plot_cols
, mat2cols
, is.cols
Examples
# Generate a matrix and plot it with a legend
data <- matrix(rnorm(50), nrow=10, ncol=5)
cols <- heat.colors(12)[12:1]
par(mar=c(5.1, 4.1, 4.1, 3.1))
plot_cols(mat2cols(data, col=cols))
heat_legend(data, cols); box(lwd=2)
[Package IMIFA version 2.2.0 Index]