plot_cols {IMIFA} | R Documentation |
Plots a matrix of colours
Description
Plots a matrix of colours as a heat map type image or as points. Intended for joint use with mat2cols
.
Usage
plot_cols(cmat,
na.col = "#808080FF",
ptype = c("image", "points"),
border.col = "#808080FF",
dlabels = NULL,
rlabels = FALSE,
clabels = FALSE,
pch = 15,
cex = 3,
label.cex = 0.6,
...)
Arguments
cmat |
A matrix of valid colours, with missing values coded as |
na.col |
Colour used for missing |
ptype |
Switch controlling output as either a heat map |
border.col |
Colour of border drawn around the plot. |
dlabels , rlabels , clabels |
Vector of labels for the diagonals, rows, and columns, respectively. |
pch |
Point type used when |
cex |
Point cex used when |
label.cex |
Govens cex parameter used for labels. |
... |
Further graphical parameters. |
Value
Either an "image"
or "points"
type plot of the supplied colours.
See Also
mat2cols
, image
, heat_legend
, is.cols
Examples
# Generate a colour matrix using mat2cols()
mat <- matrix(rnorm(100), nrow=10, ncol=10)
mat[2,3] <- NA
cols <- heat.colors(12)[12:1]
(matcol <- mat2cols(mat, cols=cols))
# Use plot_cols() to visualise the colours matrix
par(mar=c(5.1, 4.1, 4.1, 3.1))
plot_cols(matcol)
# Add a legend using heat_legend()
heat_legend(mat, cols=cols); box(lwd=2)
# Replace colour of exact zero entries:
# Often important to call mat2cols() first (to include 0 in the cuts),
# then replace relevant entries with NA for plot_cols(), i.e.
mat[2,3] <- 0
matcol2 <- mat2cols(mat, cols=cols)
plot_cols(replace(matcol2, mat == 0, NA), na.col="blue")
heat_legend(mat, cols=cols); box(lwd=2)
[Package IMIFA version 2.2.0 Index]