RATS 11.1
RATS 11.1

To help you produce publication-quality graphs, RATS gives you a great deal of flexibility in labeling graphs. We look at these in the paragraphs below.

Major Labels

The four main graphing instructions, as well as SPGRAPH, all offer HEADER, FOOTER, SUBHEADER, HLABEL, and VLABEL options. Their functions are shown in the graph below. In addition, in its title, the Graph Window will assume the name of the HEADER or the FOOTER (HEADER if you use both as we did here).

 

 

Other Labels

When the main labels are used on SPGRAPH, they are placed at these locations relative to the full graph page, and not to any single graph on it. You can use the XLABELS and YLABELS options on SPGRAPH to label the rows and columns of the graph “matrix”, or you can add the standard label types to the individual graphics instructions, which will add (smaller) labeling in the zone assigned to that graph.

 

The GRTEXT instruction is a very flexible tool that allows you to add strings of text anywhere inside or in the margins of a graph. You can select the exact location, font, size, and style of the text string.

 

SCATTER and GCONTOUR offer an XLABELS option to supply your own list of labels for the X-axis tick marks, while GBOX provides a LABELS option for labeling each of the series in the graph.

 

Supplying Labels

You can supply either a literal string of text enclosed in quotes, or a LABEL or STRING variable defined ahead of time (some options require a VECTOR of STRINGS). For example, the following GRAPH commands produce the same result:

 

graph(header="US Real GDP")

# rgdp

 

compute hlab = "US Real GDP"

graph(header=hlab)

# rgdp

 

 

Constructing Strings

Quoted strings are fine for single graphs, but if you need to generate many standardized graphs, it can be rather tedious to duplicate code and hand edit it. Fortunately, all these options will permit you to use a STRING type variable instead of a quoted string. These can be constructed, or input.

 

compute header="Coherence of "+%l(x1)+" and "+%l(x2)

graph(header=header,noticks)

# coherenc

 

compute header="Autocorrelations "+diffs+" x "+sdiffs

graph(header=header,max=1.0,min=-1.0,style=bargraph)

# corrs

 

Note: %L(series) is a special function which returns the label of a series.

 

Reading Strings From a File

If you have a standardized program, but the headers or labels can’t be constructed easily as they have no obvious pattern, make up a separate file with a list of headers (one per line) and read them in using the instruction READ:

 

open data labels.txt

declare vector[string] header(230)

read header

do i=1,230

  ...

  graph(header=header(i),...)

  #  ...

end do i

 

Line Breaks in Strings

You can use two backward slash characters \\\\ to insert line breaks in strings used in graphs. For instance,

 

spgraph(vfields=2,$

  footer="Figure 2 Spillover plot, Global Market Volatility \\\\75 Week Rolling Windows")

 

will do a two line footer.


Copyright © 2026 Thomas A. Doan