Learn R Programming

seriation (version 1.0-12)

pimage: Permutation image plot

Description

Provides methods for plotting image plots for matrix and dist objects given a permutation.

Usage

pimage(x, order = NULL, col = NULL, main ="", xlab = "", ylab = "", 
    axes = TRUE, range=NULL, colorkey=FALSE, ..., newpage=TRUE, pop=TRUE)

## S3 method for class 'matrix': pimage(x, order=NULL, col=NULL, main="", xlab="", ylab="", axes=TRUE, range=NULL, colorkey=FALSE, ..., newpage=TRUE, pop=TRUE) ## S3 method for class 'dist': pimage(x, order = NULL, col = NULL, main="", xlab="", ylab="", axes = TRUE, range=NULL, colorkey=FALSE, upper.tri = TRUE, lower.tri = TRUE, ..., newpage=TRUE, pop=TRUE)

Arguments

x
a matrix or an object of class dist.
order
an object of class ser_permutation. If NULL the order in x is plotted.
col
a list of colors used. If NULL, a gray scale is used (for matrix larger values are displayed darker and for dist smaller distances are darker). For matrices containing logical data, black and white is used.
main
Plot title.
xlab, ylab
labels for the x and y axes.
axes
a logical indicating whether to add axes using the labels of x. The default value (TRUE) shows only axes if the dimension is below 10 (so it is reasonable to show labels).
range
vector with two elements giving the range (min, max) for representing the values in the matrix.
colorkey
logical; add a colorkey?
upper.tri, lower.tri
a logical indicating whether to show the upper or lower triangle of the distance matrix.
...
further arguments passed on to image in graphics.
newpage, pop
two logical. Start plot on a new page and pop the viewports after plotting (see Grid).

Details

Plots a matrix in its original row and column orientation. This means, in a plot the columns become the x-coordinates and the reversed rows the y-coordinates.

If x is of class dist it is converted to full-storage representation before plotting.

Examples

Run this code
x <- matrix(sample(c(FALSE, TRUE), 150, rep=TRUE), ncol=10)

## matrix
pimage(x, main = "random data")

## plot seriated matrix
pimage(x, seriate(x), col = c("white", "green"), main = "reordered data")

## distances
d <- dist(x, method = "binary")
pimage(d, upper.tri = FALSE, main = "Distances", colorkey = TRUE)

pimage(d, seriate(d), upper.tri = FALSE, main = "Distances", colorkey = TRUE)

Run the code above in your browser using DataLab