Download GRAP A Language for Typesetting Graphs Tutorial and User Manual

Transcript
- 19 -
graph Linear
coord x 1785,1955 y 0,160
label left "Population" "in Millions" left .2
label right "Linear Scale," "Linear Fit"
ticks bot off
copy "usapop.d"
define fit X 35 + 1.4*($1-1870) X
line from 1850,fit(1850) to 1950,fit(1950)
graph Exponential with .Frame.n at Linear.Frame.s -(0,.05)
coord x 1785,1955 y 3,160 log y
label left "Population" "in Millions" left .2
label right "Logarithmic Scale," "Exponential Fit"
copy "usapop.d"
define fit X exp(0.75 + .012*($1-1800)) X
line from 1790,fit(1790) to 1920,fit(1920)
The statements defining each graph are indented for clarity. The second graph has the northern point of its
frame 0.05 inch below the southern point of the frame of the first graph; the with clause is passed directly
through to PIC without being evaluated for macros or expressions. The names of both graphs begin with
capital letters to conform to PIC syntax for labels.
150
100
Population
in Millions
Linear Scale,
Linear Fit
50
0
100
50
Population
in Millions
Logarithmic Scale,
Exponential Fit
20
10
5
1800
1850
1900
1950
Polynomial functions lie between the linear and exponential functions; Tukey shows how a seventhdegree polynomial provides a better (and longer) fit to the early population growth.