Plot a distance matrix (DM) or a difference distance matrix (DDM).

# S3 method for dmat
plot(x, key = TRUE, resnum.1 = c(1:ncol(x)), resnum.2 = resnum.1,
axis.tick.space = 20, zlim = range(x, finite = TRUE),
nlevels = 20, levels = pretty(zlim, nlevels),
color.palette = bwr.colors,
col = color.palette(length(levels) - 1),
axes = TRUE, key.axes, xaxs = "i", yaxs = "i", las = 1,
grid = TRUE, grid.col = "yellow", grid.nx = floor(ncol(x)/30),
grid.ny = grid.nx, center.zero = TRUE, flip=TRUE, ...)

## Arguments

x a numeric distance matrix generated by the function dm. logical, if TRUE a color key is plotted. a vector of residue numbers for annotating the x axis. a vector of residue numbers for annotating the y axis. the separation between each axis tick mark. z limits for the distances to be plotted. if levels is not specified, the range of 'z' values is divided into approximately this many levels. a set of levels used to partition the range of 'z'. Must be *strictly* increasing (and finite). Areas with 'z' values between consecutive levels are painted with the same color. a color palette function, used to assign colors in the plot. an explicit set of colors to be used in the plot. This argument overrides any palette function specification. logical, if TRUE plot axes are drawn. statements which draw axes on the plot key. It overrides the default axis. the x axis style. The default is to use internal labeling. the y axis style. The default is to use internal labeling. the style of labeling to be used. The default is to use horizontal labeling. logical, if TRUE overlaid grid is drawn. color of the overlaid grid. number of grid cells in the x direction. number of grid cells in the y direction. logical, if TRUE levels are forced to be equidistant around zero, assuming that zlim ranges from less than to more than zero. logical, indicating whether the second axis should be fliped. additional graphical parameters for image.

## Value

Called for its effect.

## References

Grant, B.J. et al. (2006) Bioinformatics 22, 2695--2696.T

Much of this function is based on the filled.contour function by Ross Ihaka.

Barry Grant

## Note

This function is based on the layout and legend key code in the function filled.contour by Ross Ihaka. As with filled.contour the output is a combination of two plots: the legend and (in this case) image (rather than a contour plot).

dm, filled.contour, contour, image

## Examples


pdb <- read.pdb( system.file("examples/1hel.pdb", package="bio3d") )

# DM
d <- dm(pdb,"calpha")

# Plot DM
##filled.contour(d, nlevels = 4)
##plot(d)
plot(d,
resnum.1 = pdb$atom[pdb$calpha,"resno"],
color.palette = mono.colors,
xlab="Residue Number", ylab="Residue Number")

if (FALSE) {
pdbs <- pdbaln( get.pdb( c( "4q21", "521p"), path=tempdir(), overwrite=TRUE))

# Get distance matrix
a <- dm.xyz(pdbs$xyz[1,]) b <- dm.xyz(pdbs$xyz[2,])

# Calculate DDM
c <- a - b

# Plot DDM
plot(c,key=FALSE, grid=FALSE)

plot(c, axis.tick.space=10,
resnum.1=pdbs$resno[1,], resnum.2=pdbs$resno[2,],
grid.col="black",
xlab="Residue No. (4q21)", ylab="Residue No. (521p)")

}