| faces {aplpack} | R Documentation |
Chernoff Faces
Description
faces represent the rows of a data matrix by faces.
plot.faces plots faces into a scatterplot.
Usage
faces(xy, which.row, fill = FALSE, face.type = 1, nrow.plot,
ncol.plot, scale = TRUE, byrow = FALSE, main, labels, na.rm = FALSE,
ncolors = 20, col.nose = rainbow(ncolors), col.eyes = rainbow(ncolors,
start = 0.6, end = 0.85), col.hair = terrain.colors(ncolors),
col.face = heat.colors(ncolors), col.lips = rainbow(ncolors,
start = 0, end = 0.2), col.ears = rainbow(ncolors, start = 0,
end = 0.2), plot.faces = TRUE)
plot.faces(x, x.pos, y.pos, face.type = 1, width = 1, height = 1, labels,
ncolors = 20, col.nose = rainbow(ncolors), col.eyes = rainbow(ncolors,
start = 0.6, end = 0.85), col.hair = terrain.colors(ncolors),
col.face = heat.colors(ncolors), col.lips = rainbow(ncolors,
start = 0, end = 0.2), col.ears = rainbow(ncolors, start = 0,
end = 0.2), ...)
Arguments
xy |
xy data matrix, rows represent individuals and columns variables |
which.row |
defines a permutation of the rows of the input matrix |
fill |
if(fill==TRUE), only the first nc attributes of the faces are
transformed, nc is the number of columns of xy |
face.type |
an integer between 0 and 2 with the meanings: 0 = line drawing faces, 1 = the elements of the faces are painted, 2 = Santa Claus faces are drawn |
nrow.plot |
number of columns of faces on graphics device |
ncol.plot |
number of rows of faces |
scale |
if(scale==TRUE), variables will be normalized |
byrow |
if(byrow==TRUE), xy will be transposed |
main |
title |
labels |
character strings to use as names for the faces |
na.rm |
if TRUE 'NA' values are removed otherwise exchanged by mean of data |
plot.faces |
if FALSE no face is plotted |
x |
an object of class faces computed by faces |
x.pos |
x coordinates of positions of faces |
y.pos |
y coordinates of positions of faces |
width |
width of the faces |
height |
height of the faces |
ncolors |
number of colors in the palettes for painting the elements of the faces |
col.nose |
palette of colors for painting the nose |
col.eyes |
palette of colors for painting the eyes |
col.hair |
palette of colors for painting the hair |
col.face |
palette of colors for painting the face |
col.lips |
palette of colors for painting the lips |
col.ears |
palette of colors for painting the ears |
... |
additional graphical arguments |
Details
Explanation of parameters:
1-height of face,
2-width of face,
3-shape of face,
4-height of mouth,
5-width of mouth,
6-curve of smile,
7-height of eyes,
8-width of eyes,
9-height of hair,
10-width of hair,
11-styling of hair,
12-height of nose,
13-width of nose,
14-width of ears,
15-height of ears. For details look at the literate program of faces
Value
list of two elements: The first element out$faces
is a list of standardized faces of class faces,
this object could be plotted by plot.faces;
a plot of faces is created on the graphics device if
plot.faces=TRUE.
The second list is short description of the effects of the variables.
Note
version 01/2009
Author(s)
H. P. Wolf
References
Chernoff, H. (1973): The use of faces to represent statistiscal assoziation, JASA, 68, pp 361–368. The smooth curves are computed by an algorithm found in Ralston, A. and Rabinowitz, P. (1985): A first course in numerical analysis, McGraw-Hill, pp 76ff. http://www.wiwi.uni-bielefeld.de/mitarbeiter/wolf/ : S/R - functions : faces
See Also
—
Examples
faces() faces(face.type=1) faces(rbind(1:3,5:3,3:5,5:7)) data(longley) faces(longley[1:9,],face.type=0) faces(longley[1:9,],face.type=1) plot(longley[1:16,2:3],bty="n") a<-faces(longley[1:16,],plot=FALSE) plot.faces(a,longley[1:16,2],longley[1:16,3],width=35,height=30) set.seed(17) faces(matrix(sample(1:1000,128,),16,8),main="random faces") a<-faces(rbind(1:3,5:3,3:5,5:7),plot.faces=FALSE) plot(0:5,0:5,type="n") plot(a,x.pos=1:4,y.pos=1:4,1.5,0.7) # during Christmastime faces(face.type=2)
Results
R version 2.11.1 (2010-05-31)
Copyright (C) 2010 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
Natural language support but running in an English locale
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(aplpack)
> png(filename="faces_%03d_med.png", width=480, height=480)
> ### Name: faces
> ### Title: Chernoff Faces
> ### Aliases: faces plot.faces
> ### Keywords: misc
>
> ### ** Examples
>
>
> faces()
effect of variables:
modified item Var
"height of face " "Var1"
"width of face " "Var2"
"structure of face" "Var3"
"height of mouth " "Var1"
"width of mouth " "Var2"
"smiling " "Var3"
"height of eyes " "Var1"
"width of eyes " "Var2"
"height of hair " "Var3"
"width of hair " "Var1"
"style of hair " "Var2"
"height of nose " "Var3"
"width of nose " "Var1"
"width of ear " "Var2"
"height of ear " "Var3"
> faces(face.type=1)
effect of variables:
modified item Var
"height of face " "Var1"
"width of face " "Var2"
"structure of face" "Var3"
"height of mouth " "Var1"
"width of mouth " "Var2"
"smiling " "Var3"
"height of eyes " "Var1"
"width of eyes " "Var2"
"height of hair " "Var3"
"width of hair " "Var1"
"style of hair " "Var2"
"height of nose " "Var3"
"width of nose " "Var1"
"width of ear " "Var2"
"height of ear " "Var3"
>
> faces(rbind(1:3,5:3,3:5,5:7))
effect of variables:
modified item Var
"height of face " "Var1"
"width of face " "Var2"
"structure of face" "Var3"
"height of mouth " "Var1"
"width of mouth " "Var2"
"smiling " "Var3"
"height of eyes " "Var1"
"width of eyes " "Var2"
"height of hair " "Var3"
"width of hair " "Var1"
"style of hair " "Var2"
"height of nose " "Var3"
"width of nose " "Var1"
"width of ear " "Var2"
"height of ear " "Var3"
>
> data(longley)
> faces(longley[1:9,],face.type=0)
effect of variables:
modified item Var
"height of face " "GNP.deflator"
"width of face " "GNP"
"structure of face" "Unemployed"
"height of mouth " "Armed.Forces"
"width of mouth " "Population"
"smiling " "Year"
"height of eyes " "Employed"
"width of eyes " "GNP.deflator"
"height of hair " "GNP"
"width of hair " "Unemployed"
"style of hair " "Armed.Forces"
"height of nose " "Population"
"width of nose " "Year"
"width of ear " "Employed"
"height of ear " "GNP.deflator"
> faces(longley[1:9,],face.type=1)
effect of variables:
modified item Var
"height of face " "GNP.deflator"
"width of face " "GNP"
"structure of face" "Unemployed"
"height of mouth " "Armed.Forces"
"width of mouth " "Population"
"smiling " "Year"
"height of eyes " "Employed"
"width of eyes " "GNP.deflator"
"height of hair " "GNP"
"width of hair " "Unemployed"
"style of hair " "Armed.Forces"
"height of nose " "Population"
"width of nose " "Year"
"width of ear " "Employed"
"height of ear " "GNP.deflator"
>
> plot(longley[1:16,2:3],bty="n")
> a<-faces(longley[1:16,],plot=FALSE)
effect of variables:
modified item Var
"height of face " "GNP.deflator"
"width of face " "GNP"
"structure of face" "Unemployed"
"height of mouth " "Armed.Forces"
"width of mouth " "Population"
"smiling " "Year"
"height of eyes " "Employed"
"width of eyes " "GNP.deflator"
"height of hair " "GNP"
"width of hair " "Unemployed"
"style of hair " "Armed.Forces"
"height of nose " "Population"
"width of nose " "Year"
"width of ear " "Employed"
"height of ear " "GNP.deflator"
> plot.faces(a,longley[1:16,2],longley[1:16,3],width=35,height=30)
>
> set.seed(17)
> faces(matrix(sample(1:1000,128,),16,8),main="random faces")
effect of variables:
modified item Var
"height of face " "Var1"
"width of face " "Var2"
"structure of face" "Var3"
"height of mouth " "Var4"
"width of mouth " "Var5"
"smiling " "Var6"
"height of eyes " "Var7"
"width of eyes " "Var8"
"height of hair " "Var1"
"width of hair " "Var2"
"style of hair " "Var3"
"height of nose " "Var4"
"width of nose " "Var5"
"width of ear " "Var6"
"height of ear " "Var7"
>
> a<-faces(rbind(1:3,5:3,3:5,5:7),plot.faces=FALSE)
effect of variables:
modified item Var
"height of face " "Var1"
"width of face " "Var2"
"structure of face" "Var3"
"height of mouth " "Var1"
"width of mouth " "Var2"
"smiling " "Var3"
"height of eyes " "Var1"
"width of eyes " "Var2"
"height of hair " "Var3"
"width of hair " "Var1"
"style of hair " "Var2"
"height of nose " "Var3"
"width of nose " "Var1"
"width of ear " "Var2"
"height of ear " "Var3"
> plot(0:5,0:5,type="n")
> plot(a,x.pos=1:4,y.pos=1:4,1.5,0.7)
> # during Christmastime
> faces(face.type=2)
effect of variables:
modified item Var
"height of face " "Var1"
"width of face " "Var2"
"structure of face" "Var3"
"height of mouth " "Var1"
"width of mouth " "Var2"
"smiling " "Var3"
"height of eyes " "Var1"
"width of eyes " "Var2"
"height of hair " "Var3"
"width of hair " "Var1"
"style of hair " "Var2"
"height of nose " "Var3"
"width of nose " "Var1"
"width of ear " "Var2"
"height of ear " "Var3"
>
>
>
>
> dev.off()
null device
1
>
>
Image(s)








