colmat: Plot color matrix

Description Usage Arguments Details Value See Also Examples

View source: R/colmat.R

Description

colmat Plot color matrix for factors/categorical data.

Usage

1
2
3
colmat(x, colframe = FALSE, transpose = TRUE, rowLab = TRUE,
  colLab = TRUE, pal = NULL, lcol = "black", rowLine = -2,
  colLine = -1, las = 2, colSize = 0.7)

Arguments

x

A matrix with samples by rows and variables by columns. See details.

colframe

Logical. Is the dataset already in colors? Default: FALSE

transpose

Logical. Transpose matrix? Default: TRUE

rowLab

Logical. Label rows? Default: TRUE

colLab

Logical. Label columns? Default: TRUE. Printed above plot.

pal

Palette used for when colframe = FALSE. See details.

lcol

Line color. Default: 'black'

rowLine

line adjustment for y-axis. See details.

colLine

line adjustment for x-axis. See details.

las

las for plot. Default: 2. See par.

colSize

Size parameter for column labels. See details.

Details

Input can either be a matrix where rows are samples and columns are variables of factors or colors. For a matrix of factors, define colFrame = FALSE, makecolors with palette pal is used to color the matrix. If colFrame = TRUE, the colors are plotted verbatim.

rowLine and colLine are line arguments for y-lab and x-lab respectively. See par. colSize is the cex.axis argument for x-lab.

Value

Plot of a colored table.

See Also

makecolors, par

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# Factor variables
x1 <- matrix(sample(c('Positive','Negative'),50,replace = TRUE),25,2,
             dimnames = list(paste('Sample',1:25,sep='_'),
             c('Mutation_1','Mutation_2')))
x2 <- sample(c('Papillary','Medullary','Mucinous'),25,replace = TRUE)
x <- cbind(x1,Type = x2); rm(x1,x2)
colmat(x)

# Color variables
x <- matrix(sample(c('skyblue3' , 'tan3'), 75, replace = TRUE), 25, 3, 
            dimnames = list(paste('Sample',1:25,sep='_'),
                            c('Var1','Var2','Var3')))
colmat(x)

sean-cho/toolkit documentation built on May 29, 2019, 4:24 p.m.