Learn R Programming

aplpack (version 1.3.5)

faces: 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, print.info = TRUE, 
    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, cex = 2) 
# S3 method for faces
plot(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), cex = 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

print.info

if TRUE information about usage of variables for face elements are printed

na.rm

if TRUE 'NA' values are removed otherwise exchanged by mean of data

plot.faces

if FALSE no face is plotted

cex

size of labels of faces

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

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.

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 painting elements of a face the colors of are found by averaging of sets of variables: (7,8)-eyes:iris, (1,2,3)-lips, (14,15)-ears, (12,13)-nose, (9,10,11)-hair, (1,2)-face.

Further details can be found in the literate program of faces.

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. https://www.uni-bielefeld.de/fakultaeten/wirtschaftswissenschaften/fakultaet/lehrende-ehemalige/pwolf/wolf_aplpack/index.xml

See Also

---

Examples

Run this code
# NOT RUN {
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)
# }

Run the code above in your browser using DataLab