Description Usage Arguments Value Author(s) See Also Examples
This is a convenience function for drawing a set of lines
distinguished by the levels of a factor.
It can be used to make more attractive plots than
available via plot.mjca
.
1 |
XY |
A two-column data frame or matrix |
group |
A factor; a separate line is drawn for each level included in |
which |
An integer vector used to select the factors for which lines are drawn. By default, all lines are drawn. |
sort |
Column of |
type |
Line type: |
col |
A vector of colors to be used for the various lines, in the order of the levels
in |
lwd |
A vector of line widths to be used for the various lines; recycled as necessary |
... |
Other graphic parameters passed to |
none
Michael Friendly
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | if (require(vcd)) {
data(PreSex, package="vcd")
presex.mca <- mjca(PreSex)
res <- plot(presex.mca, labels=0, pch='.', cex.lab=1.2)
coords <- data.frame(res$cols, presex.mca$factors)
nlev <- rle(as.character(coords$factor))$lengths
fact <- unique(as.character(coords$factor))
cols <- c("blue", "red", "brown", "black")
lwd <- c(2, 2, 2, 4)
plot(Dim2 ~ Dim1, type='n', data=coords)
points(coords[,1:2], pch=rep(16:19, nlev), col=rep(cols, nlev), cex=1.2)
text(coords[,1:2], labels=coords$level, col=rep(cols, nlev), pos=3, cex=1.2, xpd=TRUE)
multilines(coords[, c("Dim1", "Dim2")], group=coords$factor, col=cols, lwd=lwd)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.