pcp: Enhanced parallel coordinate plots.

pcpR Documentation

Enhanced parallel coordinate plots.

Description

pcp draws a parallel coordinate plot.It is a modified version of parcoord {MASS}. Variables may be reordered and panels colored in the display.

catpcp draws a parallel coordinate plot variant for categorical data.

Usage

pcp(data, order = NULL, panel.colors = NULL, col = 1, lty = 1, 
horizontal = TRUE, mar = NULL, scale = TRUE, axis.width = 0,
axis.grid.col="grey70",connect=TRUE, ...)

catpcp(data, order = NULL, pcpbars, barvars = 1:ncol(data), 
pcpbars.border = "black", pcpbars.col = NULL, pcpbars.labels = FALSE, 
pcpbars.axis.at = NULL, pcpbars.axis.labels = NULL, 
axis.width = 0.2,connect=TRUE, ...)


Arguments

data

A data frame or matrix.

order

an index vector specifying variable order. If NULL, all variables are used.

panel.colors

either a vector or a matrix of panel colors. If a vector is supplied, the ith color is used for the ith panel. If a matrix, dimensions should match those of the variables. Diagonal entries are ignored.

col

a vector of colours, recycled as necessary for each observation.

lty

a vector of line types, recycled as necessary for each observation.

horizontal

If TRUE, orientation is horizontal.

mar

margin parameters, passed to par.

scale

If TRUE, the variables are scaled to the unit interval.

axis.width

Width of each of the parallel axes.

axis.grid.col

Color of variable axes. Use NULL for no axes.

connect

If FALSE, line segments are not connected. Points are drawn if axis.width=0.

pcpbars

A list, with one component per barvar. Component i is a matrix with the bottom and top of the bars for that variable.

barvars

Categorical variables where overlayed bars show the level frequency.

pcpbars.border

Border colour of the bars.

pcpbars.col

Colour of the bars.

pcpbars.labels

Labels for the bars.

pcpbars.axis.at

Axis label positions for the bars.

pcpbars.axis.labels

Axis label text for the bars.

...

other parameters, passed to pcp by catpcp

Examples

require(PairViz) 		
y <- as.data.frame(as.table(HairEyeColor))

colvar <- 3 # any of 1:3 will do
y <- y[order(y[,colvar]),] # ensures that cases are ordered by colour within each factor level
ylong <- apply(y[,-4],2, function(x) rep(x,times=y[,4]))

cols <- desaturate_color(rainbow(4,alpha=0.3),.5)
cols <- cols[as.numeric(as.factor(ylong[,colvar]))]




ds <- factor_spreadout(ylong)




dev.new(width=5,height=2.5)
par(mar=c(2,1,2,1))
par( cex.axis=.8,cex=.8)



catpcp(ds$data,col=cols,lwd=2,pcpbars=ds$bars,pcpbars.labels=TRUE,main="Hair Eye data")

	
	
	
	
	

PairViz documentation built on Aug. 12, 2022, 5:06 p.m.