Draws a parallel coordinate plot, with an accompanying barchart showing an index (eg correlation, scagnostics) levels for each panel. An index legend is optional.
guided_pcp(data, edgew=NULL, path = NULL, pathw=NULL,zoom=NULL,pcpfn=pcp,
pcp.col = 1,lwd=0.5, panel.colors=NULL, pcp.mar=c(1.5,2,2,2), pcp.scale=TRUE,
bar.col=1:9,bar.axes=FALSE, bar.mar=NULL,bar.ylim=NULL, reorder.weights=TRUE,
layout.heights=NULL, layout.widths=c(10,1),
main=NULL,legend=FALSE,cex.legend = 1,legend.mar=c(1,4,1,1),...)
A data frame or matrix.
Matrix (or vector) whose rows give index values for each pair of variables.
an index vector specifying variable order, or a function. If a function, find_path(edgew,path,...)
constructs the index vector.
Matrix (or vector) whose rows give index values for each adjacent pair of variables in path. Usually this argument is NULL and pathw
is computed from the path
and edgew
.
If provided, a numeric vector specifying a subsequence of path to display.
Function to draw the parallel coordinates.
Line colors.
Line widths.
Background panel colors, passed to thepcpfn
Controls PCP margin size.
If TRUE, the variables will be scaled to 0-1 range, otherwise the data is not scaled.
Bar colors.
Draw barplot axes, if TRUE.
Controls barplot margin size.
Vertical limits of bar plot.
If TRUE, reorder barplot indices so large values are drawn at the bottom.
Controls the layout.
Controls the layout.
Main title for PCP.
If TRUE, draws the barplot index legend.
Controls legend text size.
Legend margin size.
Optional arguments
C.B. Hurley and R.W. Oldford
see overview
pcp
,catpcp
require(PairViz)
data <- mtcars[,c(1,3:6)]
cols <- c("red","green")[mtcars[,9]+1 ] # transmission type, red=automatic
# add a correlation guide and find "better" hamiltonians...
# add a correlation guide...
corw <- dist2edge(as.dist(cor(data)))
edgew <- cbind(corw*(corw>0), corw*(corw<0))
# add a correlation guide to a PCP, positive cors shown in blue, negative in purple...
if (FALSE) {
dev.new(width=3,height=3)
par(cex.axis=.65)
guided_pcp(data,edgew, pcp.col=cols,
main="Correlation guided PCP",bar.col = c("blue","purple"))
dev.new(width=7,height=3)
par(cex.axis=.65)
guided_pcp(data,edgew, path=eulerian, pcp.col=cols,lwd=2,
main="Correlation guided Eulerian PCP",bar.col = c("blue","purple"),bar.axes=TRUE)
}
# Scagnostic guides are useful here- see the demos for more examples.
Run the code above in your browser using DataLab