Enhanced scatterplot matrix

Share:

Description

This function draws a scatterplot matrix of data. Variables may be reordered and panels colored in the display.

Usage

1
cpairs(data, order = NULL, panel.colors = NULL, border.color = "grey70", show.points = TRUE, ...)

Arguments

data

a numeric matrix

order

the order of variables. Default is the order in data.

panel.colors

a matrix of panel colors. If supplied, dimensions should match those of the pairs plot. Diagonal entries are ignored.

border.color

used for panel border.

show.points

If FALSE, no points are drawn.

...

graphical parameters passed to pairs.default.

Author(s)

Catherine B. Hurley

References

Hurley, Catherine B. “Clustering Visualisations of Multidimensional Data”, to appear in JCGS.

See Also

pairs, cparcoord, dmat.color,colpairs, order.single.

Examples

 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
data(USJudgeRatings)
judge.cor <- cor(USJudgeRatings)
judge.color <- dmat.color(judge.cor)
# Colors variables by their correlation.
cpairs(USJudgeRatings,panel.colors=judge.color,pch=".",gap=.5)
judge.o <- order.single(judge.cor)
# Reorder variables so that those with highest correlation 
# are close to the  diagonal.
cpairs(USJudgeRatings,judge.o,judge.color,pch=".",gap=.5)

# Specify your own color scheme
judge.color <- dmat.color(judge.cor, breaks=c(-1,0,.5,.9,1), colors = 
cm.colors(4))

data(bank)
# m is a homogeneity measure of each pairwise variable plot
m <- -colpairs(scale(bank[,-1]), partition.crit,gfun=gave,groups=bank[,1])

# Color panels by level of m and reorder variables so that
# pairs with high m are near the diagonal. Panels shown
# in pink have the highest amount of group homogeneity, as measured by 
# gave.
cpairs(bank[,-1],order=order.single(m), panel.colors=dmat.color(m),
gap=.3,col=c("purple","black")[bank[,"Status"]+1],
pch=c(5,3)[bank[,"Status"]+1])