plot.connectedness {connectedness}R Documentation

Plot disconnected sets in a two-way classification

Description

plot.connectedness plots disconnected sets in a two-way classification without interaction.

Usage

plot.connectedness(x, set=NULL, matrix=TRUE, scale=TRUE,
                   lines=FALSE, linesSet=NULL,
                   col=NULL,
                   plotArg=list(xlab=x$factors[1],
                                ylab=x$factors[2]),
                   polygonArg=NULL,
                   pointsArg=list(pch=rep(19, x$nSets)),
                   linesArg=NULL, ...)

Arguments

x connectedness, output from connectedness
set integer, which set to plot, all sets if NULL
matrix boolean, if TRUE, plot a matrix of polygons, otherwise plot points
scale boolean, if TRUE, scale axes in relation to number of records per each level, otherwise not
lines boolean, connect cells with lines within sets
linesSet numeric, set number i.e. which sets should have connected cells
col character, valid color "names" for cell polygons or points, see details
plotArg list, arguments passed to plot
polygonArg list, arguments passed to polygon, see details
pointsArg list, arguments passed to points if matrix=FALSE, see details
linesArg list, arguments passed to lines if lines=TRUE, see details
... arguments for other methods, not used

Details

Colors for polygons, points and lines can be given with col for all elements or separately within ploygonArg, pointsArg and linesArg. By default col is NULL and colors are given internally. Set of colors is taken from RColorBrewer package, specifically from qualitative palettes. Read help page of brewer.pal for more. Only 54 colors are defined and an error is issued, if there are more than 54 sets in your data. You should define colors by yourself in that case. For a start you can access 54 internal colors with connectedness:::.colors.

Length of all arguments in ploygonArg, pointsArg and linesArg is assumed to be equal to the number of sets in x. If it is less, recycling will occur. Therefore, result might be a mess, unless lengths of arguments are 1. In last case all sets will have equal value for the corresponding argument(s).

Plot does not handle drop slot in x and draws cells only for used levels. This might change if I get a got idea how to plot "missing" cels ;)

Author(s)

Gregor Gorjanc (colors were taken from RColorBrewer package)

See Also

connectedness, levelsBySet and subset.connectedness

Examples


data(connect)
table(connect$group, connect$season)
tmp <- connectedness(x=connect$group, y=connect$season)

## Plot method
par(mfrow=c(2, 2))
plot(tmp)

plot(tmp, matrix=FALSE, lines=TRUE, col=c("green", "blue"),
     pointsArg=list(pch=c(15, 19), cex=2), linesArg=list(lwd=2))

plot(tmp, scale=FALSE, lines=TRUE, linesSet=1,
     linesArg=list(col="black", lwd=2))

plot(tmp, set=2, col=c("gray"),
     plotArg=list(xlab="Group", ylab="Season"))

[Package connectedness version 0.2-1 Index]