Learn R Programming

IMIFA (version 1.3.1)

plot_cols: 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 allowed. Vectors should be supplied as matrices with 1 row or column, as appropriate.

na.col

Colour used for missing NA entries in cmat.

ptype

Switch controlling output as either a heat map "image" (the default) or as "points".

border.col

Colour of border drawn around the plot.

dlabels

Vector of labels for the diagonals.

rlabels

Vector of labels for the rows.

clabels

Vector of labels for the columns.

pch

Point type used when ptype="points".

cex

Point cex used when ptype="points".

label.cex

Govens cex parameter used for labels.

...

Further graphical parameters.

Value

Either an "image" or "points" plot of the supplied colours.

See Also

mat2cols, image, heat_legend, is.cols

Examples

Run this code
# NOT RUN {
# 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)
matcol

# Use plot_cols() to visualise the colours matrix
par(mar=c(5.1, 4.1, 4.1, 4.1))
plot_cols(matcol)

# Add a legend using heat_legend()
heat_legend(mat, cols=cols); box(lwd=2)
# }

Run the code above in your browser using DataLab