ColorCodeObsByGroups

Prototype

void ColorCodeObsByGroups( DataObject dobj, Matrix mGroupVarNames, Matrix mColors )

Parameters

DataObject dobj
The DataObject containing the data.

Matrix mGroupVarNames
A character matrix containing the names of the variables that define the groups.

Matrix mColors
An (n x 3) matrix of RGB colors or an (n x 1) vector of integer color values.

Remarks

This module color-codes the observations in a DataObject according to unique values of the group variables specified in mGroupVarNames. An internal color map is created by calling the BlendColors module, which blends the mColors matrix into k colors where k is the number of groups. Each observation is then drawn in the color assigned to its group.

If the matrix mColors is a 3-column matrix, column 1 specifies the color's red component (0–255), column 2 specifies the color's green component (0–255), and column 3 specifies the color's blue component (0–255). If mColors is a vector, each entry is either a predefined constant (BLACK, BLUE, BROWN, CHARCOAL, CREAM, CYAN, GOLD, GRAY, GREY, GREEN, LILAC, LIME, MAGENTA, MAROON, OLIVE, ORANGE, PINK, PURPLE, RED, ROSE, SALMON, STEEL, TAN, VIOLET, WHITE, or YELLOW) or a hexadecimal value of the form 00rrggbbX, where rr specifies the color's red component (00–FF hexadecimal), gg specifies the color's green component (00–FF hexadecimal), and bb specifies the color's blue component (00–FF hexadecimal).

Example
declare DataObject dobj;
dobj = DataObject.CreateFromFile( "baseball" );
colors = GREEN // RED // YELLOW // BLUE;
run ColorCodeObsByGroups( dobj, {"league" "division"}, colors );
ScatterPlot.Create(dobj, "no_atbat", "no_home");
See Also

BlendColors
GetSortedMatrixByGroups