[R] parallel coordinate plot showing density of curves
Michael Friendly
friendly at yorku.ca
Tue Feb 4 02:41:48 CET 2014
Given a set of numeric variables and a group factor, as in the iris data
used below,
I`d like to show a parallel coordinate plot, where instead of trace
lines, I want
to show something of the density distribution of the variable values for
each
group.
Some approximations to what I want are shown below, using lattice,
and simple techniques to show density *visually*, varying the amount
of "ink".
I'd like to know if there is a *statistical* implementation that would do
something like this, either in the lattice or ggplot2 families. (I'm sure
there is, but any help with syntax would be appreciated.)
library(lattice)
data("iris")
vnames <- c("Sepal\nLength", "Sepal\nWidth", "Petal\nLength",
"Petal\nWidth")
parallelplot(~iris[1:4], iris, groups = Species,
varnames = vnames,
horizontal.axis = FALSE, lwd=2,
col=c("red", "blue", "green3"))
# thicker line width
parallelplot(~iris[1:4], iris, groups = Species,
varnames = vnames,
horizontal.axis = FALSE, lwd=4,
col=c("red", "blue", "green3"))
# use alpha-blennding
parallelplot(~iris[1:4], iris, groups = Species,
varnames = vnames,
horizontal.axis = FALSE, lwd=8,
col=c(rgb(1,0,0,.2), rgb(0,0,1,.2), rgb(0,205/255,0,.2) )
)
--
Michael Friendly Email: friendly AT yorku DOT ca
Professor, Psychology Dept. & Chair, Quantitative Methods
York University Voice: 416 736-2100 x66249 Fax: 416 736-5814
4700 Keele Street Web: http://www.datavis.ca
Toronto, ONT M3J 1P3 CANADA
More information about the R-help
mailing list