Skip to content

parallel coordinate plot showing density of curves

2 messages · Michael Friendly, Jim Lemon

#
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) )
   )
#
On 02/04/2014 12:41 PM, Michael Friendly wrote:
Hi Michael,
I may be completely off the track here, but just on the off chance...

data(iris)
library(plotrix)
x11(width=6,height=10)
oldpar<-panes(nrow=3,ncol=1)
par(mar=c(5,4,4,2))
dendroPlot(iris[iris$Species=="setosa",1:4],breaks=list(10,10,10,10),
  setlabels=names(iris)[1:4],main="Setosa",xlab="Measurement",ylab="Cm")
dendroPlot(iris[iris$Species=="versicolor",1:4],breaks=list(10,10,10,10),
  setlabels=names(iris)[1:4],main="Versicolor",xlab="Measurement",ylab="Cm")
dendroPlot(iris[iris$Species=="virginica",1:4],breaks=list(10,10,10,10),
  setlabels=names(iris)[1:4],main="Virginica",xlab="Measurement",ylab="Cm")
par(oldpar)

Jim