plot.connectedness {connectedness} | R Documentation |
plot.connectedness
plots disconnected subsets in a two-way
classification without interaction.
plot.connectedness(x, subset=NULL, matrix=TRUE, scale=TRUE, lines=FALSE, linesSubset=NULL, col=NULL, plotArg=list(xlab=x$factors[1], ylab=x$factors[2]), polygonArg=NULL, pointsArg=list(pch=rep(19, x$nSubsets)), linesArg=NULL, ...)
x |
connectedness, output from connectedness |
subset |
integer, which subset to plot, all subsets if NULL |
matrix |
logical, if TRUE, plot a matrix of polygons, otherwise plot points |
scale |
logical, if TRUE, scale axes in relation to number of records per each level, otherwise not |
lines |
logical, connect cells with lines within subsets |
linesSubset |
numeric, subset number i.e. which subsets 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 |
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. Colors are 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 subsets in
your data (sigh!). 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 subsets 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 subsets
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 ;)
Gregor Gorjanc (colors were taken from RColorBrewer package)
connectedness
, levelsBySubset
and
subset.connectedness
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, linesSubset=1, linesArg=list(col="black", lwd=2)) plot(tmp, subset=2, col=c("gray"), plotArg=list(xlab="Group", ylab="Season"))