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:



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 line styles. 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.

Background Color/Shading


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.

Pattern Definitions


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