# Drawing Chernoff graph in R with only four face features?

I have used aplpack package faces() method in R for drawing a Chernoff graph of the following data. I would like to draw a face with only four variables a, b, c, and d in order to explain why program A is better than program B. However, the faces() method is also using these variables for several other face features. Could you please help me to draw a Chernoff face having four features with these four variables. For example: length: a, width: d, eyes: b, and nose: c. Just I wanted to distinguish face graphs of programs A and B only with these four face features, and rest of the face features should be the same between programs A and B face graphs.

prog  a   b    c    d
A    0.8 7900  70  27
B    0.3 1920 393  43
• Which faces function are you using? There is not one in the standard packages, but there are in more than one other package. – Greg Snow Aug 9 '11 at 16:28
• @Greg: from aplpack package. oga-lab.net/RGM2/func.php?rd_id=aplpack:faces – samarasa Aug 9 '11 at 17:22
• funny ... this is the second time in 5 years I see someone using chernoff faces. Thought they are just shifting the problem of understanding the visualization of multiple dimensions to a new level but do not solve it. – mlwida Aug 10 '11 at 7:07
• @steffen: Actually I have solved the actual problem -- I know the reasons behind why program A performance better than program B. However, I would like to provide nice graphs to the readers for better understanding... – samarasa Aug 10 '11 at 23:55

I guess the "problem" is the default behavior of R to duplicate columns/row if the required dimension is the higher than the dimension of the provided data.

Hence the fix is to set the components of the face you want to be variable explicitly and set the rest to a constant. This code snippet should illustrate this:

require(aplpack)

# a length corresponds to index 1
# d width corresponds to index 2
# b eyes corresponds to 7 and 8
# c nose  corresponds to 12 and 13

# data as specified by the OP
opdat <- data.frame("a"=c(0.8,0.3),"b"=c(7900,1920),"c"=c(70,393),"d"=c(27,43))
rownames(opdat)<- c("A","B")
# original plot
faces(opdat,face.type=0)

# now create data.frame for plotting.
plotdat <- matrix(1,nrow=2,ncol=15) # all constant
rownames(plotdat)<- c("A","B")
# now set only the columns aka face components of interest
plotdat[,1]<-opdat$a plotdat[,2]<-opdat$d
plotdat[,c(7.8)]<-opdat$b plotdat[,c(12,13)] <- opdat$c

faces(plotdat,face.type=0)

Before:

After: