Chernoff Faces from aplpack

I’ve been playing around with the faces function from the R package aplpack.  I haven’t used it in a while, but there are some new features that I’ve either never noticed before or they are new.  Color has been added to the faces and you can now plot the faces.  There is also the superfluously fantastic option of displaying the faces as Santa Claus.

Here are some of my examples:

Golf: Statistics from several of my friends collected via  (I’m SITW on the lower right.) The face is handicap, the mouth is scoring average, the eyes are average putts, the hair is the percentage of fairways hit, nose is greens in regulation (GIR), and ears are the total number of rounds you play. The faces are plotted with fairway percentage on the x-axis and GIR on the y-axis.

Santa_Golf: Same golf data with Santa option.

NFL2010: Final NFL regular season team statistics.  The face represent the offense and the defense is represented by hair. The size of the nose indicates sacks, the ears indicate turnovers (ear width is interceptions; ear height is forced fumbles).  The eyes indicate penalties and, finally, the size of the mouth indicates wins with a smiling face if the team made the playoffs (a really nice touch, if you ask me.)  The face at the bottom right indicates the league leader.

Some observations on the NFL faces:  The two superbowl teams last year (Pittsburgh and Green Bay) are both located at the bottom of the graph and there faces look very, very similar.  San Diego looks similar to to both Green Bay and Pittsburgh (similar face, nose, eyes, and hair), but the big differences are the ears and, of course, the San Diego face is frowning.  Another thing that pops out at me is how similar Houston and New England look to each other.  They have very similar face shape, eyes, and hair.  The big differences are the nose and ears (sacks and turnovers).












x$abbr[33]<-“League Leader”

x$lab<-paste(x$abbr,x$W,sep=”: “)


##Playoff Teams: creating a playoff indicator





##Finding the league leader in all variables





x$lab<-paste(x$abbr,x$W,sep=”: “)

##Defining the names


names(x)[c(13,14,15,16)]<-c(“Off PPG”,”Off YPG”,”Off Pass”,”Off Rush”)

names(x)[c(22,23)]<-c(“Penalties”,”Pen Yards”)

names(x)[c(26:29)]<-c(“Def PPG”,”Def YPG”,”Def Pass”,”Def Rush”)

names(x)[c(5:6)]<-c(“Points For”,”Points Against”)


##Columns used for plotting

x<- x[order(x[,4]),]


##Offense = face, Defense = hair, penalty= eyes, Wins and playoffs = mouth, turnovers = ears

##Columns used for faces: which columns am i going to use for the data


##creating the faces without plotting them.


##creating text for the legend

g<-paste(a[[2]][,1],a[[2]][,2],sep=”: “)

##building the plot

plot(x[,plot.cols],bty=”n”,xlim=c(200,600),main=”2010 NFL Season”)


##plotting the faces


Posted on August 7, 2011, in Math Pictures, Sports. Bookmark the permalink. 1 Comment.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: