The following commands control colors:
• Fill Color() for solid areas
• Level Color() for categorical data
• Pen Color() for lines and points
• Back Color() for the background of text (similar to the box around the erased text in Figure 12.19)
• Background Color() for the graph’s background color
• Font Color() for added text
Fill colors overwrite pen colors for drawn shapes. You do not get both, as in some drawing packages. To get both a fill and a pen line, draw two shapes, one with fill and one without. You can select a color with a single numeric argument, a color name in quotation marks, or an RGB value. The standard colors are specified with numbers 0–15 (both 0 and 15 are black) or by their names (Table 12.1).
Tip: For more shades, add the word Dark, Medium Dark, Medium Light, or Light before a color name in quotation marks.
Number |
Name |
---|---|
0 |
Black |
1 |
Gray |
2 |
White |
3 |
Red |
4 |
Green |
5 |
Blue |
6 |
Orange |
7 |
BlueGreen |
8 |
Purple |
9 |
Yellow |
10 |
Cyan |
11 |
Magenta |
12 |
YellowGreen |
13 |
BlueCyan |
14 |
Fuchsia |
The following script creates a graph that shows all JMP colors:
Text Color( 0 );
New Window( "Colors",
Graph Box(
FrameSize( 640, 400 ),
Y Scale( -1, 17 ),
X Scale( -3, 12 ),
k = 0;
For( jj = 1, jj <= 12, jj += 2,
l = 15;
For( i = 0, i <= 15 & k < 85, i++,
thiscolor = Color To RGB( k );
Fill Color( k );
thisfill = 1;
If( thiscolor == {1, 1, 1},
Pen Color( 0 );
thisfill = 0;
,
Pen Color( k )
);
Rect( jj, l + .5, jj + .5, l, thisfill );
Text( {jj - 1, l}, "color ", k );
k++;
l--;
);
);
jj = -2;
color = {"Black", "Gray", "White", "Red", "Green", "Blue", "Orange", "BlueGreen",
"Purple", "Yellow", "Cyan", "Magenta", "YellowGreen", "BlueCyan", "Fuschia", "Black"};
For(
i = 0;
l = 15;, i <= 15 & l >= 0,
i++;
l--;,
Text( {jj, l}, color[i + 1] )
);
) );
Larger numbers cycle through shading variations of the same color sequence. A script demonstrating this appears under “Colors and Markers”. Values outside the range 0–84 are not accepted.
Number |
Result |
---|---|
16–31 |
Medium Dark |
32–47 |
Medium Light |
48–63 |
Dark |
64–79 |
Light |
80–84 |
Light, Medium Light, Gray, Medium Dark, Dark |
If you prefer to use RGB values, create a list with the fraction for each color in red, green, and blue order.
Pen Color( {.38,.84,.67} ); // teal
RGB Color() and Color to RGB() convert color values between JMP color numbers and the red-green-blue system. The following example finds the RGB values for JMP color 3 (red):
Color to RGB( 3 );
{0.941176470588235, 0.196078431372549, 0.274509803921569}
Likewise, HLS Color() and Color to HLS() convert color values between JMP color numbers and the hue-lightness-saturation system.
win = New Window( "Color Wheel",
Graph(
Frame Size( 200, 200 ),
For( hue = 0, hue < 360, hue += 30,
y = 50 - 40 * Cos( hue * 2 * Pi() / 360 );
x = 50 + 40 * Sin( hue * 2 * Pi() / 360 );
Fill Color( HLS Color( hue / 360, 0.5, 1 ) );
Oval( x - 10, y - 10, x + 10, y + 10, 1 );
)
)
);
Finally, Heat Color() returns the JMP color that corresponds to a value in any color theme that is supported by Cell Plot, Treemap, and so on. The syntax is:
Heat Color( n, <<"theme" )
The theme message is optional, and the default value is "Blue to Gray to Red". You can specify any color theme, including custom color themes. You can also create and use an anonymous color theme as shown in the following examples:
Heat Color( z, <<{"", {{1, 1, 0}, {0, 0, 1}} } );
Heat Color( z, <<{"", {blue, green, yellow} } )