ColorCodeLinesByGroups

Prototype

void ColorCodeLinesByGroups( LinePlot plot, Matrix mGroupVarNames, Matrix mColors )

Parameters

LinePlot plot
A line plot created with the LinePlot.CreateWithGroup method using the group variables specified in mGroupVarNames.

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 lines in a line plot 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 line 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( "air" );
dobj.SetNominal( "day" );
declare LinePlot plot;
plot = LinePlot.CreateWithGroup( dobj, "hour", "co", "day" );
colors = RED // YELLOW // GREEN // BLUE // MAGENTA // WHITE // BLACK;
days = { "Mon" "Tue" "Wed" "Thu" "Fri" "Sat" "Sun" };
run ColorCodeLinesByGroups( plot, "day", colors );
run DrawLegend( plot, days, 8, colors, SOLID, NULL, 0xE8E8E8, "ORC" );
See Also

GetSortedMatrixByGroups