Learn R Programming

adegraphics (version 1.0-21)

table.image: Heat map-like representation with colored cells

Description

This function represents a two dimensional table plot in which cells are colored according with their value.

Usage

table.image(dftab, coordsx = 1:ncol(as.matrix(dftab)), coordsy =
  nrow(as.matrix(dftab)):1, labelsx, labelsy, nclass = 3,
  breaks = NULL, col = NULL, plot = TRUE, storeData =
  TRUE, add = FALSE, pos = -1, ...)

Value

An object of class ADEg (subclass T.image) or ADEgS (if add is TRUE).

The result is displayed if plot is TRUE.

Arguments

dftab

a data frame, matrix, contingency table or distance matrix used to produce the plot

coordsx

an integer or a vector indicating the columns of dftab kept

coordsy

an integer or a vector indicating the rows of dftab kept

labelsx

columns labels

labelsy

rows labels

breaks

a vector of values to split dftab. If NULL, pretty(dftab, nclass) is used.

nclass

an integer for the number of desired intervals, ignored if breaks is not missing.

col

a color or a colors vector used for the cells

plot

a logical indicating if the graphics is displayed

storeData

a logical indicating if the data should be stored in the returned object. If FALSE, only the names of the data arguments are stored

add

a logical. If TRUE, the graphic is superposed to the graphics already plotted in the current device

pos

an integer indicating the position of the environment where the data are stored, relative to the environment where the function is called. Useful only if storeData is FALSE

...

additional graphical parameters (see adegpar and trellis.par.get)

Author

Alice Julien-Laferriere, Aurelie Siberchicot aurelie.siberchicot@univ-lyon1.fr and Stephane Dray

See Also

T.image ADEg.T

Examples

Run this code
tab <- as.table(matrix(rnorm(900), ncol = 30))
g1 <- table.image(tab)

# add a continuous color bar as legend
# update(g1, plegend.drawColorKey = TRUE)

g2 <- table.image(tab, n = 100, coordsx = c(30, 1:29), plegend.drawKey = FALSE)

data(rpjdl, package = "ade4")
X <- data.frame(t(rpjdl$fau))
Y <- data.frame(t(rpjdl$mil))
coa1 <- ade4::dudi.coa(X, scannf = FALSE)
g3 <- table.image(Y, coordsx = rank(coa1$co[, 1]), coordsy = 1:8, nclas = 5, 
  labelsx = "", plegend.drawKey = FALSE)

Run the code above in your browser using DataLab