| pimage {seriation} | R Documentation |
Provides methods for plotting image plots for
matrix and dist objects given a permutation.
pimage(x, order = NULL, col = NULL, xlab = "", ylab = "", axes = NULL, ...)
## S3 method for class 'matrix':
pimage(x, order = NULL, col = NULL,
xlab = "", ylab = "", axes = NULL, ...)
## S3 method for class 'dist':
pimage(x, order = NULL, col = NULL,
xlab = "", ylab = "", axes = NULL,
upper.tri = TRUE, lower.tri = TRUE, ...)
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. |
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 (NULL) shows only axes
if the dimension is below 32 (so it is reasonable to show labels). |
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. |
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.
Christian Buchta and Michael Hahsler
image for details.
x <- matrix(sample(c(FALSE, TRUE), 150, rep=TRUE), ncol=10)
## matrix
pimage(x, main = "random data")
## plot seriated matrix and axis separately
pimage(x, seriate(x), col = c("white", "green"), axes = FALSE,
main = "reordered data")
axis(1, at = 1:ncol(x)) # columns
axis(2, at = 1:nrow(x), labels= rev(1:nrow(x))) # reversed rows
## distances
d <- dist(x, method = "binary")
pimage(d, lower.tri = FALSE)
pimage(d, seriate(d), lower.tri = FALSE)