Graphics / Style Definitions |
The default styles are designed to work well in most circumstances, but you can also define your own custom styles to suit your preferences or organizational standards. You do this using Graph Style Definitions. RATS defines 30 different styles for color lines, grayscale (black and white) lines, color patterns, grayscale patterns, color symbols, and grayscale symbols. (If you have a graph which uses more than 30 styles, these repeat, so 31 is the same as 1). You can override any of those.
You have control over the following:
•For lines in color graphs: the pattern (solid line or one of seven dashed patterns), the line color and the thickness.
•For lines in grayscale graphs: the pattern, the grayscale level and the thickness.
•For fill patterns (as used in bar graphs and similar styles) in color graphs: the pattern, with seven patterns from which to choose (solid and six types of “hatch” patterns) and the color.
•For fill patterns in grayscale: the hatch pattern and the grayscale level.
•For symbols in color graphs: the shape (twelve choices), the color, and whether or not the symbol is filled or not filled.
•For symbols in grayscale graphs: the shape, the grayscale level, and whether or not the symbol is filled or not filled.
You're most likely to want to redefine the black and white styles, since those will be used most often in publications.
Style Definitions
A style definition will take one of the following forms, depending upon what you want to change.
LINE_COLOR_NN=pattern,color,thickness
LINE_BW_NN=pattern,gray,thickness
FILL_COLOR_NN=pattern,color
FILL_BW_NN=pattern,gray
SYMBOL_COLOR_NN=pattern,color,filled
SYMBOL_BW_NN=pattern,gray,filled
On the left side of the =, the first part of the definition specifies the type of representation you are defining (LINE, FILL, or SYMBOL). The second part (COLOR or BW) tells whether it is a color or black and white style. The third part (NN) is the style number that you’re defining. It should be between 0 and 30. Style 0 is reserved for fill shading performed using the SHADE options, so if you want to adjust the pattern or gray level used for shading, define the FILL_BW_0 style.
The style to be used is described using the following:
pattern |
a number indicating the pattern choice—solid or dashed for lines, hatch pattern for fills, and symbol shape for symbols. See Pattern Definitions for the available choices. |
color |
is represented as a 24 bit (six digit) hexadecimal number (the "RGB" code for the color). The first two hexadecimal digits are the level of red (00=no red to FF=red fully on), the next two are the level of green and the final two the level of blue. |
gray |
is a real number between 0 and 1 representing the degree of “grayness” (fraction of white). 0 means black, 1 means white. Note that it’s much easier to distinguish the lighter end of this (near 1) than the darker end: 0 and .25 look very similar, .90 and .95 look quite different. The default values for the first four black and white fills are solid black, solid .90 gray, solid .50 gray and solid .80 gray. |
thickness |
is a real-valued scale factor where 1.0 represents a standard line thickness. To make a line three times the standard thickness, use 3.0. |
filled |
is 0 for not filled (outline only) and 1 for filled. |
Examples
The line graphs shown in Chapter 1 used a style set with these definitions:
LINE_BW_01=0,0.00,1.0
LINE_BW_02=0,0.60,1.0
LINE_BW_03=0,0.80,1.0
Here, we are redefining the styles for the first three black and white lines. The first value after the = selects line pattern 0 (a solid line—see Pattern Definitions) for all three. The second parameter sets the gray scale value. Here, we use solid black, 60% gray, and 80% gray. (Note again that in gray scale, a higher number is lighter). The third parameter sets the line thickness—we’re using the default size of 1.0.
We’re only changing the black and white styles, so color versions of the graphs will use the default styles (solid lines, with black, blue, and green as the colors for the first three styles). But in black and white mode, the graphs will use solid lines in black, 60% gray, and 80% gray, respectively, rather than default of a solid line and two dashed line styles (all in black).
GRPARM(DEFINE option)
The easiest way to let RATS know about the desired style definitions is with the GRPARM instruction with the DEFINE option. The argument to DEFINE is a (quoted) definition string taking the form shown, one per instruction. For instance,
grparm(define="LINE_BW_01=0,0.00,1.0")
grparm(define="LINE_BW_02=0,0.60,1.0")
grparm(define="LINE_BW_03=0,0.80,1.0")
will do the three line definitions in the example above. If you have a whole set of styles that you commonly use, you can create a SOURCE file including these and any other graphics style options, like fixing the representation with GRPARM(PATTERNS) or the size with GRPARM with the HEIGHT and WIDTH options). For instance, the following will pull in the definitions from the file QReviewStyles.src.
source QReviewStyles.src
You can turn these off easily by just putting a comment * at the start of the line while you get the program working, then take it off to create final graphs in the desired style.
GRPARM(IMPORT option)
The older method is to create an external text file. For instance, the three line definitions from the example would be on a file with just the definitions:
LINE_BW_01=0,0.00,1.0
LINE_BW_02=0,0.60,1.0
LINE_BW_03=0,0.80,1.0
Suppose we call this file graphstyles_00_60_80.txt. Then you would use something like
open styles graphstyles_00_60_80.txt
grparm(import=styles)
This is quite a bit clumsier than the newer GRPARM(DEFINE=..) method, so we would recommend switching if you've been using the older method.
The default background color for the main graph box is white. You can redefine this color or pattern to be used by using the instruction
GRPARM(BACKGROUND=stylenum)
which chooses a (color) fill style number. Similarly, the shading used by the SHADING option (on GRAPH) or VSHADE or HSHADE (on SCATTER and GCONTOUR), which, by default is a very light solid gray, can also be redefined. With
GRPARM(SHADING=stylenum)
you can pick a different color fill style. Finally, the grid lines used by the GRID or VGRID options (on GRAPH), VGRID or HGRID (on SCATTER and GCONTOUR) or VGRID (on GBOX) can be redefined with
GRPARM(GRID=stylenum)
The default is a "hairline" (very thin) solid black. Here the stylenum is a color line style.
The available line, fill, and symbol choices are shown below. To select a line, fill, or symbol for a given style, use the number in the left-hand column as the pattern parameter. For example, SYMBOL_COLOR_2=1,FF0000,1 defines color symbol style number two as a square symbole (1 being the pattern code for a box symbol), red (R all on at FF, G and B 0's), filled.
Code |
Line Pattern |
Fill Pattern |
Symbol |
0 |
|
|
|
1 |
|
|
|
2 |
|
|
|
3 |
|
|
|
4 |
|
|
|
5 |
|
|
|
6 |
|
|
|
7 |
|
|
|
8 |
|
|
|
9 |
|
|
|
10 |
|
|
|
11 |
|
|
|
12 |
|
|
|
Example
This defines a specific size, uses black and white patterns rather than color and redefines the four black and white line styles, using black and light gray solid lines and black and light gray dashes, all with somewhat thicker lines than normal.
grparm(height=4.5,width=7.0,patterns)
grparm(define="line_bw_1=0,0.0,2.0")
grparm(define="line_bw_2=0,0.8,2.0")
grparm(define="line_bw_3=1,0.0,2.0")
grparm(define="line_bw_4=1,0.8,2.0")
graph(style=line,key=attached,footer="Figure 3.15",$
klabels=||"AGRICULTURE","MANUFACTURING","RETAIL","SERVICES"||) 4
# ga8gff
# ga8gm
# ga8gr
# ga8gs
Standard Values
These show the first ten default styles for all six types. They are presented as GRPARM DEFINE's so you can easily copy the default and adjust them in a program.
Color Lines
These are thin solid lines of different colors.
grparm(define="LINE_COLOR_01=0,000000,1.0")
grparm(define="LINE_COLOR_02=0,0000ff,1.0")
grparm(define="LINE_COLOR_03=0,00ff00,1.0")
grparm(define="LINE_COLOR_04=0,ff0000,1.0")
grparm(define="LINE_COLOR_05=0,00ffff,1.0")
grparm(define="LINE_COLOR_06=0,ff00ff,1.0")
grparm(define="LINE_COLOR_07=0,ffff00,1.0")
grparm(define="LINE_COLOR_08=0,808080,1.0")
grparm(define="LINE_COLOR_09=0,ff8000,1.0")
grparm(define="LINE_COLOR_10=0,804000,1.0")
Black and White Lines
Through style 7, these are thin black with dots and dashes. Beginning with 8 they switch to thicker gray lines.
grparm(define="LINE_BW_01=0,0.0,1.0")
grparm(define="LINE_BW_02=1,0.0,1.0")
grparm(define="LINE_BW_03=2,0.0,1.0")
grparm(define="LINE_BW_04=4,0.0,1.0")
grparm(define="LINE_BW_05=3,0.0,1.0")
grparm(define="LINE_BW_06=5,0.0,1.0")
grparm(define="LINE_BW_07=6,0.0,1.0")
grparm(define="LINE_BW_08=0,0.5,2.5")
grparm(define="LINE_BW_09=0,0.7,2.5")
grparm(define="LINE_BW_10=0,0.9,2.5")
Color Symbols
Except for 10, these are all unfilled squares of different colors. (The same color progression as the colored lines).
grparm(define="SYMBOL_COLOR_01=1,000000,0")
grparm(define="SYMBOL_COLOR_02=1,0000ff,0")
grparm(define="SYMBOL_COLOR_03=1,00ff00,0")
grparm(define="SYMBOL_COLOR_04=1,ff0000,0")
grparm(define="SYMBOL_COLOR_05=1,00ffff,0")
grparm(define="SYMBOL_COLOR_06=1,ff00ff,0")
grparm(define="SYMBOL_COLOR_07=1,ffff00,0")
grparm(define="SYMBOL_COLOR_08=1,808080,0")
grparm(define="SYMBOL_COLOR_09=1,ff8000,0")
grparm(define="SYMBOL_COLOR_10=1,000000,1")
Black and White Symbols
These are unfilled symbols, drawn in black.
grparm(define="SYMBOL_BW_01=1,0.0,0")
grparm(define="SYMBOL_BW_02=2,0.0,0")
grparm(define="SYMBOL_BW_03=3,0.0,0")
grparm(define="SYMBOL_BW_04=4,0.0,0")
grparm(define="SYMBOL_BW_05=5,0.0,0")
grparm(define="SYMBOL_BW_06=6,0.0,0")
grparm(define="SYMBOL_BW_07=7,0.0,0")
grparm(define="SYMBOL_BW_08=8,0.0,0")
grparm(define="SYMBOL_BW_09=9,0.0,0")
grparm(define="SYMBOL_BW_10=10,0.0,0")
Color Fills
These are solid color fills with the same color progression as the lines.
grparm(define="FILL_COLOR_01=0,000000")
grparm(define="FILL_COLOR_02=0,0000ff")
grparm(define="FILL_COLOR_03=0,00ff00")
grparm(define="FILL_COLOR_04=0,ff0000")
grparm(define="FILL_COLOR_05=0,00ffff")
grparm(define="FILL_COLOR_06=0,ff00ff")
grparm(define="FILL_COLOR_07=0,ffff00")
grparm(define="FILL_COLOR_08=0,808080")
grparm(define="FILL_COLOR_09=0,ff8000")
grparm(define="FILL_COLOR_10=0,804000")
Black and White Fills
Through style 4, these are solid with different shades of gray. Styles 5 through 10 are different "hatch" patterns.
grparm(define="FILL_BW_01=0,0.00")
grparm(define="FILL_BW_02=0,0.85")
grparm(define="FILL_BW_03=0,0.50")
grparm(define="FILL_BW_04=0,0.75")
grparm(define="FILL_BW_05=1,0.00")
grparm(define="FILL_BW_06=2,0.00")
grparm(define="FILL_BW_07=3,0.00")
grparm(define="FILL_BW_08=4,0.00")
grparm(define="FILL_BW_09=5,0.00")
grparm(define="FILL_BW_10=6,0.00")
Copyright © 2025 Thomas A. Doan