dmat.color {gclus} | R Documentation |
Colors a symmetric matrix
Description
Accepts a dissimilarity matrix or dist
m
, and
returns a matrix of colors.
Values in m
are cut
into categories using breaks
(ranked distances if
byrank
is TRUE
) and categories are assigned the values
in colors
.
Usage
dmat.color(m, colors = default.dmat.color, byrank = NULL, breaks = length(colors))
Arguments
m |
a dissimilarity matrix or the result of |
colors |
a vector of colors. The default is
|
byrank |
boolean, default |
breaks |
the number of break points. |
Details
breaks
are passed to the functioncut
.
If byrank
is TRUE
, values in m
are
ranked before they are categorized.
If byrank
is TRUE
and breaks
is an integer, then
there are breaks
equal-sized categories.
Value
Returns a matrix of colors. The matrix is symmetric, with NAs on the diagonal.
Author(s)
Catherine B. Hurley
See Also
Examples
data(longley)
longley.cor <- cor(longley)
# A matrix with equal (or nearly equal) number of entries of each color.
longley.color <- dmat.color(longley.cor)
# Plot the colors
plotcolors(longley.color,dlabels=rownames(longley.color))
# Try different color schemes
# A matrix where each color represents an equal-length interval.
longley.color <- dmat.color(longley.cor, byrank=FALSE)
# Specify colors and breaks
longley.color <- dmat.color(longley.cor, breaks=c(-1,0,.5,.8,1),
cm.colors(4))
# Could also reorder variables prior to plotting:
longley.o <- order.single(longley.cor)
longley.color <- longley.color[longley.o,longley.o]
# The colors can be used in a scatterplot matrix or parallel
# coordinate display:
cpairs(longley, panel.color= longley.color)
cparcoord(longley, panel.color= longley.color)
[Package gclus version 1.3.2 Index]