Here is a link to the recently approved
Wolfram Function Repository
function
ChernoffFace.
There are some important extensions of the original ChernoffFace
scope described above:
allowing for auto-coloring with the option "ColorFunction", and
allowing a list of records to be visualized.
The latter is not done just with a Map
call -- if the data argument can be interpreted as a full array, then the columns are rescaled first. (Each column is rescaled separately.)
An example illustrating that follows.
Get the "USArrests" data:
data = ExampleData[{"Statistics", "USArrests"}];
Dimensions[data]
(* {50, 5} *)
Get the corresponding column names:
dataColumnNames = ExampleData[{"Statistics", "USArrests"}, "ColumnHeadings"]
(* {"StateName", "Murder", "Assault", "UrbanPopulation", "Rape"} *)
Here is a summary of the dataset:
ResourceFunction["RecordsSummary"][data, dataColumnNames]
Visualize with Chernoff faces:
Block[{data = data[[All, 2 ;; -1]], recNames = data[[All, 1]], dataColumnNames = dataColumnNames[[2 ;; -1]], imgs},
imgs = ResourceFunction["ChernoffFace"][data, ColorFunction -> "Rainbow", ImageSize -> 100];
imgs = MapThread[Append[#1, PlotLabel -> #2] &, {imgs, recNames}];
Legended[
Grid[Partition[imgs, 8], Dividers -> All],
Placed[Framed[
Grid[Thread[{Take[Keys@ResourceFunction["ChernoffFace"]["FaceParts"], Length[dataColumnNames]], dataColumnNames}],
Alignment -> {{Right, Left}}]], "Top"]]
]