Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Make Chernoff face diagrams
makes a Chernoff face diagram for the numeric vector vec.
makes a Chernoff face diagram for an Association asc of facial features to numeric values.
makes a list of Chernoff face diagrams corresponding to the rows of matrix.
makes a list of Chernoff face diagrams corresponding to the elements of listOfAssociations.
makes Chernoff face diagrams using specified options opts.
Here is a Chernoff face diagram with a list of random numbers:
Here is another Chernoff face constructed from random data:
If the length of the vector argument is larger than the number of facial features, only the first 17 elements are taken:
Here is a random numeric matrix (a list of vectors):
Visualize the random matrix with Chernoff face diagrams:
Visualize a summary legend that helps the reading of the table of diagrams above:
The main signature of ChernoffFace is using an association that specifies numerical values for different face parts of the diagram:
The argument association can have specifications for the face part colors and face symmetry:
The order of the face parts is based on research on which diagram features influence most influence how Chernoff face diagrams are perceived and comprehended.
Given the argument "Properties", a default association for making Chernoff face diagrams is retrieved:
Use "FaceParts" or "FacePartsProperties" to get an association with only the face parts:
Here are the additional, non-numerical properties (face parts colors and symmetry):
Here is a list of face-part-to-value associations:
Using the option ColorFunction, we can produce different colorings:
The option ColorFunction assigns automatic colors to argument's association keys:
The faces can be made symmetric for shorter records.
Here is a random numeric vector:
Here are diagrams produced with different values for the option "MakeSymmetric":
The option "MakeSymmetric" overrides the argument's association value of "MakeSymmetric":
If the data argument is a numeric matrix or a list of associations with numeric values, then the data columns are rescaled to run between 0 and 1. The rescaling is done with Rescale using a data-range-finding function specified as a value to the option "RescaleRangeFunction" (the default of which is MinMax).
Here is a random numerical matrix:
Here is a summary of the matrix:
Here is a list of Chernoff face diagrams produced with the default value for the option "RescaleRangeFunction":
Here is a list of Chernoff face diagrams produced by making the ranges of the matrix columns slightly wider than they are:
In order to study a dataset with Chernoff face diagrams, we have to provide: (1) a list of Chernoff face diagrams; (2) a legend that shows how the face features are mapped to dataset's columns; and (3) a legend that shows Chernoff face diagrams for easy-to-understand instances of the dataset.
Get the "EmployeeAttitude" data:
Get the corresponding column names:
Here is a summary of the dataset:
Visualize with Chernoff faces:
Make a table of records summary diagrams:
We can see that: (1) higher learning is associated with higher ratings; (2) the higher the privileges, the higher the ratings. Other observations can also be made.
It is a good idea to compare the diagrams made with ChernoffFace to diagrams made with SectorChart:
ChernoffFace invoked over an association or a list of numbers rescales the values of the argument data to run from 0 to 1 over the range Min[data]to Max[data]. ChernoffFace called on a list of associations or a matrix rescales the columns of the corresponding full array. Hence, in general, the diagrams produced by invoking ChernoffFace record-wise over a list of records are different from the diagrams produced by invoking ChernoffFace over the whole data set of records.
Here is a random numeric matrix (list of records):
Here are Chernoff face diagrams made separately for each record:
Here are Chernoff face diagrams made for the whole array:
We see that although the diagrams from the two lists are similar, they also have notable differences. With different data distributions, the differences will be greater or smaller.
The same data visualized with different color schemes might make certain items or features more obscure or more prominent.
Using the "BrightBands" color scheme makes all diagrams to look unique:
Using the "WatermelonColors" color scheme over the same data makes the first and the last diagram to stand out:
A table of random Chernoff faces:
This work is licensed under a Creative Commons Attribution 4.0 International License