heat_legend | R Documentation |
Using only base graphics, this function appends a colour key legend for heatmaps produced by, for instance, plot_cols
or image
.
heat_legend(data, cols = NULL, breaks = NULL, cex.lab = 1, ...)
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. |
Modifies an existing plot by adding a colour key legend.
image
, plot_cols
, mat2cols
, is.cols
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.