Description Usage Arguments Details Value Author(s) See Also Examples
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
.
1 | dmat.color(m, colors = default.dmat.color, byrank = NULL, breaks = length(colors))
|
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. |
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.
Returns a matrix of colors. The matrix is symmetric, with NAs on the diagonal.
Catherine B. Hurley
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | 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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.