%!PS %%Version: 3.3 %%DocumentFonts: (atend) %%Pages: (atend) %%EndComments % % Version 3.3 prologue for troff files. % /#copies 1 store /aspectratio 1 def /formsperpage 1 def /landscape false def /linewidth .3 def /magnification 1 def /margin 0 def /orientation 0 def /resolution 720 def /rotation 1 def /xoffset 0 def /yoffset 0 def /roundpage true def /useclippath true def /pagebbox [0 0 612 792] def /R /Times-Roman def /I /Times-Italic def /B /Times-Bold def /BI /Times-BoldItalic def /H /Helvetica def /HI /Helvetica-Oblique def /HB /Helvetica-Bold def /HX /Helvetica-BoldOblique def /CW /Courier def /CO /Courier def /CI /Courier-Oblique def /CB /Courier-Bold def /CX /Courier-BoldOblique def /PA /Palatino-Roman def /PI /Palatino-Italic def /PB /Palatino-Bold def /PX /Palatino-BoldItalic def /Hr /Helvetica-Narrow def /Hi /Helvetica-Narrow-Oblique def /Hb /Helvetica-Narrow-Bold def /Hx /Helvetica-Narrow-BoldOblique def /KR /Bookman-Light def /KI /Bookman-LightItalic def /KB /Bookman-Demi def /KX /Bookman-DemiItalic def /AR /AvantGarde-Book def /AI /AvantGarde-BookOblique def /AB /AvantGarde-Demi def /AX /AvantGarde-DemiOblique def /NR /NewCenturySchlbk-Roman def /NI /NewCenturySchlbk-Italic def /NB /NewCenturySchlbk-Bold def /NX /NewCenturySchlbk-BoldItalic def /ZD /ZapfDingbats def /ZI /ZapfChancery-MediumItalic def /S /S def /S1 /S1 def /GR /Symbol def /inch {72 mul} bind def /min {2 copy gt {exch} if pop} bind def /setup { counttomark 2 idiv {def} repeat pop landscape {/orientation 90 orientation add def} if /scaling 72 resolution div def linewidth setlinewidth 1 setlinecap pagedimensions xcenter ycenter translate orientation rotation mul rotate width 2 div neg height 2 div translate xoffset inch yoffset inch neg translate margin 2 div dup neg translate magnification dup aspectratio mul scale scaling scaling scale /Symbol /S Sdefs cf /Times-Roman /S1 S1defs cf 0 0 moveto } def /pagedimensions { useclippath userdict /gotpagebbox known not and { /pagebbox [clippath pathbbox newpath] def roundpage currentdict /roundpagebbox known and {roundpagebbox} if } if pagebbox aload pop 4 -1 roll exch 4 1 roll 4 copy landscape {4 2 roll} if sub /width exch def sub /height exch def add 2 div /xcenter exch def add 2 div /ycenter exch def userdict /gotpagebbox true put } def /pagesetup { /page exch def currentdict /pagedict known currentdict page known and { page load pagedict exch get cvx exec } if } def /decodingdefs [ {counttomark 2 idiv {y moveto show} repeat} {neg /y exch def counttomark 2 idiv {y moveto show} repeat} {neg moveto {2 index stringwidth pop sub exch div 0 32 4 -1 roll widthshow} repeat} {neg moveto {spacewidth sub 0.0 32 4 -1 roll widthshow} repeat} {counttomark 2 idiv {y moveto show} repeat} {neg setfunnytext} ] def /setdecoding {/t decodingdefs 3 -1 roll get bind def} bind def /w {neg moveto show} bind def /m {neg dup /y exch def moveto} bind def /done {/lastpage where {pop lastpage} if} def /f { dup /font exch def findfont exch dup /ptsize exch def scaling div dup /size exch def scalefont setfont linewidth ptsize mul scaling 10 mul div setlinewidth /spacewidth ( ) stringwidth pop def } bind def /changefont { /fontheight exch def /fontslant exch def currentfont [ 1 0 fontheight ptsize div fontslant sin mul fontslant cos div fontheight ptsize div 0 0 ] makefont setfont } bind def /sf {f} bind def /cf { dup length 2 idiv /entries exch def /chtab exch def /newfont exch def findfont dup length 1 add dict /newdict exch def {1 index /FID ne {newdict 3 1 roll put} {pop pop} ifelse} forall newdict /Metrics entries dict put newdict /Metrics get begin chtab aload pop 1 1 entries {pop def} for newfont newdict definefont pop end } bind def % % A few arrays used to adjust reference points and character widths in some % of the printer resident fonts. If square roots are too high try changing % the lines describing /radical and /radicalex to, % % /radical [0 -75 550 0] % /radicalex [-50 -75 500 0] % % Move braceleftbt a bit - default PostScript character is off a bit. % /Sdefs [ /bracketlefttp [201 500] /bracketleftbt [201 500] /bracketrighttp [-81 380] /bracketrightbt [-83 380] /braceleftbt [203 490] /bracketrightex [220 -125 500 0] /radical [0 0 550 0] /radicalex [-50 0 500 0] /parenleftex [-20 -170 0 0] /integral [100 -50 500 0] /infinity [10 -75 730 0] ] def /S1defs [ /underscore [0 80 500 0] /endash [7 90 650 0] ] def % % Tries to round clipping path dimensions, as stored in array pagebbox, so they % match one of the known sizes in the papersizes array. Lower left coordinates % are always set to 0. % /roundpagebbox { 7 dict begin /papersizes [8.5 inch 11 inch 14 inch 17 inch] def /mappapersize { /val exch def /slop .5 inch def /diff slop def /j 0 def 0 1 papersizes length 1 sub { /i exch def papersizes i get val sub abs dup diff le {/diff exch def /j i def} {pop} ifelse } for diff slop lt {papersizes j get} {val} ifelse } def pagebbox 0 0 put pagebbox 1 0 put pagebbox dup 2 get mappapersize 2 exch put pagebbox dup 3 get mappapersize 3 exch put end } bind def %%EndProlog %%BeginSetup mark /resolution 720 def setup 2 setdecoding %%EndSetup %%Page: 1 1 /saveobj save def mark 1 pagesetup 10 R f (AT&T Bell Laboratories)2 993 1 2563 1740 t (Murray Hill, New Jersey 07974)4 1267 1 2426 1860 t (Computing Science Technical Report No. 114)5 1848 1 2136 3000 t 12 B f (Grap \320 A Language for Typesetting Graphs)6 2309 1 1905 3270 t (Tutorial and User Manual)3 1352 1 2384 3420 t 10 I f (Jon L. Bentley)2 574 1 2773 3660 t (Brian W. Kernighan)2 814 1 2653 3780 t 10 R f (Revised, May 1991)2 780 1 720 6240 t cleartomark showpage saveobj restore %%EndPage: 1 1 %%Page: 0 2 /saveobj save def mark 2 pagesetup 12 B f (Grap \320 A Language for Typesetting Graphs)6 2309 1 1905 1230 t (Tutorial and User Manual)3 1352 1 2384 1380 t 10 I f (Jon L. Bentley)2 574 1 2773 1620 t (Brian W. Kernighan)2 814 1 2653 1740 t 10 R f (AT&T Bell Laboratories)2 993 1 2563 1920 t (Murray Hill, New Jersey 07974)4 1267 1 2426 2040 t 10 I f (ABSTRACT)2823 2540 w (Grap)1360 2800 w 10 R f ( of the 1984 age distribution in)6 1257( graph)1 255( This)1 231(is a language for describing plots of data.)7 1668 4 1599 2800 t (the United States)2 683 1 1110 2920 t cleartomark saveobj restore %%BeginGlobal % % Version 3.3 drawing procedures for dpost. Automatically pulled in, but only % when needed. % /inpath false def /savematrix matrix def /Dl { inpath {pop pop neg lineto} {newpath neg moveto neg lineto stroke} ifelse } bind def /De { /y1 exch 2 div def /x1 exch 2 div def /savematrix savematrix currentmatrix def neg exch x1 add exch translate x1 y1 scale 0 0 1 0 360 inpath {1 0 moveto arc savematrix setmatrix} {newpath arc savematrix setmatrix stroke} ifelse } bind def /Da { /dy2 exch def /dx2 exch def /dy1 exch def /dx1 exch def dy1 add neg exch dx1 add exch dx1 dx1 mul dy1 dy1 mul add sqrt dy1 dx1 neg atan dy2 neg dx2 atan inpath {arc} {newpath arc stroke} ifelse } bind def /DA { /dy2 exch def /dx2 exch def /dy1 exch def /dx1 exch def dy1 add neg exch dx1 add exch dx1 dx1 mul dy1 dy1 mul add sqrt dy1 dx1 neg atan dy2 neg dx2 atan inpath {arcn} {newpath arcn stroke} ifelse } bind def /Ds { /y2 exch def /x2 exch def /y1 exch def /x1 exch def /y0 exch def /x0 exch def x0 5 x1 mul add 6 div y0 5 y1 mul add -6 div x2 5 x1 mul add 6 div y2 5 y1 mul add -6 div x1 x2 add 2 div y1 y2 add -2 div inpath {curveto} {newpath x0 x1 add 2 div y0 y1 add -2 div moveto curveto stroke} ifelse } bind def %%EndGlobal /saveobj save def mark 10 R f 2169 3082 2169 4522 Dl 4329 3082 2169 3082 Dl 4329 4522 4329 3082 Dl 2169 4522 4329 4522 Dl 2169 4594 2169 4522 Dl (0)2144 4704 w 2654 4594 2654 4522 Dl (20)2604 4704 w 3139 4594 3139 4522 Dl (40)3089 4704 w 3625 4594 3625 4522 Dl (60)3575 4704 w 4110 4594 4110 4522 Dl (80)4060 4704 w 2097 4522 2169 4522 Dl (0)2022 4542 w 2097 4234 2169 4234 Dl (1)2022 4254 w 2097 3946 2169 3946 Dl (2)2022 3966 w 2097 3658 2169 3658 Dl (3)2022 3678 w 2097 3370 2169 3370 Dl (4)2022 3390 w 2097 3082 2169 3082 Dl (5)2022 3102 w (Population)1495 3762 w (\(in millions\))1 498 1 1463 3882 t (1984 Age)1 391 1 3054 4842 t 2193 3455 2169 3480 Dl 2217 3475 2193 3454 Dl 2241 3503 2217 3476 Dl 2265 3580 2241 3504 Dl 2289 3592 2265 3580 Dl 2314 3605 2290 3593 Dl 2338 3616 2314 3606 Dl 2363 3612 2339 3617 Dl 2386 3626 2362 3611 Dl 2411 3579 2387 3626 Dl 2435 3545 2411 3579 Dl 2459 3439 2435 3544 Dl 2484 3451 2460 3439 Dl 2508 3490 2484 3452 Dl 2533 3508 2509 3490 Dl 2556 3472 2532 3508 Dl 2581 3432 2557 3472 Dl 2605 3353 2581 3432 Dl 2629 3318 2605 3352 Dl 2654 3306 2630 3318 Dl 2678 3298 2654 3305 Dl 2703 3241 2679 3298 Dl 2726 3258 2702 3240 Dl 2751 3287 2727 3258 Dl 2775 3287 2751 3287 Dl 2799 3311 2775 3287 Dl 2823 3322 2799 3312 Dl 2848 3335 2824 3323 Dl 2872 3376 2848 3336 Dl 2896 3388 2872 3376 Dl 2921 3454 2897 3390 Dl 2945 3432 2921 3454 Dl 2969 3448 2945 3431 Dl 2993 3483 2969 3449 Dl 3018 3453 2994 3483 Dl 3042 3469 3018 3452 Dl 3066 3698 3042 3470 Dl 3091 3686 3067 3698 Dl 3115 3679 3091 3686 Dl 3139 3663 3115 3678 Dl 3163 3773 3139 3663 Dl 3212 3810 3164 3773 Dl 3236 3837 3212 3811 Dl 3261 3852 3237 3838 Dl 3285 3877 3261 3852 Dl 3309 3870 3285 3877 Dl 3333 3875 3309 3870 Dl 3358 3905 3334 3876 Dl 3381 3882 3357 3905 Dl 3406 3898 3382 3881 Dl 3430 3854 3406 3899 Dl 3454 3846 3430 3853 Dl 3479 3860 3455 3845 Dl 3503 3842 3479 3861 Dl 3528 3848 3504 3841 Dl 3551 3840 3527 3848 Dl 3576 3834 3552 3840 Dl 3600 3850 3576 3833 Dl 3624 3855 3600 3850 Dl 3649 3851 3625 3856 Dl 3673 3873 3649 3850 Dl 3698 3899 3674 3874 Dl 3721 3924 3697 3899 Dl 3746 3943 3722 3925 Dl 3770 3965 3746 3943 Dl 3794 3971 3770 3966 Dl 3819 3973 3795 3971 Dl 3843 3998 3819 3973 Dl 3867 4014 3843 4000 Dl 3891 4038 3867 4014 Dl 3916 4054 3892 4038 Dl 3940 4085 3916 4055 Dl 3964 4107 3940 4085 Dl 3988 4126 3964 4107 Dl 4013 4158 3989 4127 Dl 4037 4174 4013 4159 Dl 4061 4202 4037 4174 Dl 4086 4225 4062 4202 Dl 4110 4248 4086 4226 Dl 4134 4283 4110 4248 Dl 4158 4271 4134 4283 Dl 4183 4313 4159 4270 Dl 4207 4336 4183 4313 Dl 4231 4358 4207 4337 Dl 4256 4370 4232 4359 Dl 4280 4384 4256 4370 Dl 4304 4402 4280 4384 Dl 4328 4421 4304 4403 Dl (is produced by the)3 735 1 1110 5080 t 10 I f (grap)1870 5080 w 10 R f (commands)2084 5080 w 9 CW f (coord x 0,89 y 0,5)4 972 1 1470 5250 t (label left "Population" "\(in millions\)")4 2106 1 1470 5360 t (label bottom "1984 Age")3 1242 1 1470 5470 t (draw solid)1 540 1 1470 5580 t (copy "agepop.d")1 810 1 1470 5690 t 10 R f (\(Each line in the data \256le)5 1026 1 1110 5870 t 10 CW f (agepop.d)2167 5870 w 10 R f (contains an age and the number of Americans of that age)10 2332 1 2678 5870 t (alive in 1984; the \256le is sorted by age.\))8 1557 1 1110 5990 t (The)1360 6146 w 10 I f (grap)1541 6146 w 10 R f (preprocessor works with)2 983 1 1756 6146 t 10 I f (pic)2765 6146 w 10 R f ([4] and)1 286 1 2913 6146 t 10 I f (troff)3225 6146 w 10 R f ( input is passed through)4 958( of its)2 230([5]. Most)1 398 3 3424 6146 t (untouched, but statements between)3 1440 1 1110 6266 t 10 CW f (.G1)2589 6266 w 10 R f (and)2808 6266 w 10 CW f (.G2)2991 6266 w 10 R f (are translated into)2 743 1 3210 6266 t 10 I f (pic)3992 6266 w 10 R f (commands that draw)2 858 1 4152 6266 t (graphs.)1110 6386 w (Revised, May 1991)2 780 1 720 6866 t cleartomark showpage saveobj restore %%EndPage: 0 2 %%Page: 1 3 /saveobj save def mark 3 pagesetup 12 B f (Grap \320 A Language for Typesetting Graphs)6 2309 1 1905 1230 t (Tutorial and User Manual)3 1352 1 2384 1380 t 10 I f (Jon L. Bentley)2 574 1 2773 1620 t (Brian W. Kernighan)2 814 1 2653 1740 t 10 R f (AT&T Bell Laboratories)2 993 1 2563 1920 t (Murray Hill, New Jersey 07974)4 1267 1 2426 2040 t 10 B f (1. Introduction)1 670 1 720 2400 t 10 I f (Grap)970 2556 w 10 R f ( such services as automatic scaling)5 1439( provides)1 378( It)1 120(is a language for describing graphical displays of data.)8 2248 4 1215 2556 t (and labeling of axes, and)4 1039 1 720 2676 t 10 CW f (for)1795 2676 w 10 R f (statements,)2011 2676 w 10 CW f (if)2493 2676 w 10 R f (statements, and macros to facilitate user programmability.)6 2379 1 2648 2676 t 10 I f (Grap)5087 2676 w 10 R f (is)5333 2676 w (intended primarily for including graphs in documents prepared on the)9 2827 1 720 2796 t 9 R f (UNIX)3575 2796 w 10 S f (\322)3800 2796 w 10 R f (operating system, and is only margi-)5 1490 1 3910 2796 t (nally useful for elementary tasks in data analysis.)7 1969 1 720 2916 t ( to)1 106(Section 2 of this document is a tutorial introduction)8 2077 2 970 3072 t 10 I f (grap)3181 3072 w 10 R f (; readers who \256nd it slow going may wish to skim)10 2030 1 3370 3072 t ( of graphs that)3 598( examples in Section 3 illustrate the various kinds)8 2060(ahead. The)1 471 3 720 3192 t 10 I f (grap)3882 3192 w 10 R f (can produce and some common)4 1296 1 4104 3192 t 10 I f (grap)720 3312 w 10 R f ( matters about using)3 814(idioms. Mundane)1 726 2 935 3312 t 10 I f (grap)2502 3312 w 10 R f (are discussed in Section 4, and Section 5 contains a brief reference)11 2682 1 2718 3312 t (manual.)720 3432 w ( sev-)1 196( In)1 138( we present.)2 489(We have tried to illustrate good principles of statistics and graphical design in the graphs)14 3607 4 970 3588 t ( of illustrating)2 567(eral places, though, good taste has lost to the necessity)9 2187 2 720 3708 t 10 I f (grap)3499 3708 w 10 R f ( interested in statisti-)3 836(capabilities. Readers)1 851 2 3713 3708 t (cal integrity and taste should consult the literature, for example [2], [6], [3].)12 3022 1 720 3828 t 10 B f (2. Tutorial)1 481 1 720 4068 t 10 R f (The following is a simple)4 1022 1 970 4224 t 10 I f (grap)2017 4224 w 10 R f (program\262)2231 4224 w 9 CW f (.G1)1080 4394 w (54.2)1080 4504 w (49.4)1080 4614 w (49.2)1080 4724 w (50.0)1080 4834 w (48.2)1080 4944 w (...)1080 5054 w (43.87)1080 5164 w (.G2)1080 5274 w 10 R f ( the winning time in seconds for the men's 400 meter run, from the \256rst modern)15 3296(The single number on each line is)6 1384 2 720 5454 t ( the \256le)2 300( If)1 116( \(1896\) to the twenty-\256rst \(1988\).)5 1343(Olympic Games)1 653 4 720 5574 t 10 CW f (olymp.g)3157 5574 w 10 R f (contains the text above, then typing the com-)7 1798 1 3602 5574 t (mand)720 5694 w 9 CW f (grap olymp.g | pic | troff > junk)7 1782 1 1080 5864 t 10 R f (creates a)1 345 1 720 6044 t 10 I f (troff)1090 6044 w 10 R f (output \256le)1 409 1 1288 6044 t 10 CW f (junk)1722 6044 w 10 R f (that contains the picture)3 957 1 1987 6044 t 8 S1 f (__________________)720 6880 w 8 R f ( the \256rst \256ve lines and the last line of data \256les; omitted lines are indicated)15 2425(\262 Throughout this document we will show only)7 1535 2 720 6980 t (by ``...''.)1 284 1 720 7080 t cleartomark showpage saveobj restore %%EndPage: 1 3 %%Page: 2 4 /saveobj save def mark 4 pagesetup 10 R f (- 2 -)2 166 1 2977 480 t 2082 840 2082 2280 Dl 4242 840 2082 840 Dl 4242 2280 4242 840 Dl 2082 2280 4242 2280 Dl 2120 2352 2120 2280 Dl (0)2095 2462 w 2594 2352 2594 2280 Dl (5)2569 2462 w 3067 2352 3067 2280 Dl (10)3017 2462 w 3540 2352 3540 2280 Dl (15)3490 2462 w 4014 2352 4014 2280 Dl (20)3964 2462 w 2010 2046 2082 2046 Dl (45)1885 2066 w 2010 1438 2082 1438 Dl (50)1885 1458 w 10 S f (\267)2191 948 w (\267)2286 1531 w (\267)2381 1555 w (\267)2476 1458 w (\267)2571 1677 w (\267)2665 1507 w (\267)2760 1749 w (\267)2854 1725 w (\267)2949 1919 w (\267)3044 1883 w (\267)3139 1919 w (\267)3234 1956 w (\267)3328 1859 w (\267)3423 2078 w (\267)3517 2053 w (\267)3612 2211 w (\267)3707 2107 w (\267)3802 2156 w (\267)3897 2114 w (\267)3991 2154 w (\267)4086 2202 w 10 R f ( the times are contained in)5 1091( If)1 124( seconds.)1 374(The graph shows the decrease in winning times from 54.2 seconds to 43.87)12 3091 4 720 2730 t (the \256le)1 275 1 720 2850 t 10 CW f (400mtimes.d)1020 2850 w 10 R f (, we could produce the same graph with the shorter program)10 2403 1 1680 2850 t 9 CW f (copy "400mtimes.d")1 972 1 1080 3020 t 10 R f (Writing)720 3200 w 10 CW f (copy)1061 3200 w 10 R f (fname"" in a)2 513 1 1331 3200 t 10 I f (grap)1875 3200 w 10 R f (program is equivalent to including the contents of \256le)8 2191 1 2095 3200 t 10 CW f (fname)4317 3200 w 10 R f (at that point in the)4 752 1 4648 3200 t ( the interests of compatibility with other programs,)7 2032(\256le. \(In)1 319 2 720 3320 t 10 CW f (include)3096 3320 w 10 R f (is a synonym for)3 669 1 3541 3320 t 10 CW f (copy)4235 3320 w 10 R f (.\))4475 3320 w (Each line in the \256le)4 777 1 970 3476 t 10 CW f (400mpairs.d)1772 3476 w 10 R f (contains two numbers, the year of the Olympics and the winning time:)11 2814 1 2457 3476 t 9 CW f (1896 54.2)1 486 1 1080 3646 t (1900 49.4)1 486 1 1080 3756 t (1904 49.2)1 486 1 1080 3866 t (1908 50.0)1 486 1 1080 3976 t (1912 48.2)1 486 1 1080 4086 t (...)1080 4196 w (1988 43.87)1 540 1 1080 4306 t 10 R f (If we plot this data with the program)7 1462 1 720 4486 t 9 CW f (copy "400mpairs.d")1 972 1 1080 4656 t 10 R f (the bottom \()2 489 1 720 4836 t 10 I f (x)1209 4836 w 10 R f (\) axis represents the year of the Olympics.)7 1685 1 1253 4836 t 2082 4998 2082 6438 Dl 4242 4998 2082 4998 Dl 4242 6438 4242 4998 Dl 2082 6438 4242 6438 Dl 2297 6510 2297 6438 Dl (1900)2197 6620 w 3327 6510 3327 6438 Dl (1950)3227 6620 w 2010 6204 2082 6204 Dl (45)1885 6224 w 2010 5596 2082 5596 Dl (50)1885 5616 w 10 S f (\267)2191 5106 w (\267)2274 5689 w (\267)2356 5713 w (\267)2438 5616 w (\267)2521 5835 w (\267)2686 5665 w (\267)2768 5907 w (\267)2851 5883 w (\267)2933 6077 w (\267)3015 6041 w (\267)3263 6077 w (\267)3345 6114 w (\267)3427 6017 w (\267)3510 6236 w (\267)3592 6211 w (\267)3674 6369 w (\267)3756 6265 w (\267)3839 6314 w (\267)3921 6272 w (\267)4003 6312 w (\267)4086 6360 w 10 R f (The ``holes'' in)2 626 1 720 6888 t 10 I f (x)1371 6888 w 10 R f ( Because)1 382(-values re\257ect the fact that the 1916, 1940, and 1944 Olympics were cancelled due to war.)15 3603 2 1415 6888 t (the previous data \(in)3 827 1 720 7008 t 10 CW f (400mtimes.d)1575 7008 w 10 R f (\) had just one number per line,)6 1241 1 2235 7008 t 10 I f (grap)3504 7008 w 10 R f (viewed it as a ``time series'' and supplied)7 1680 1 3720 7008 t 10 I f (x)720 7128 w 10 R f ( ,)1 33( 3)1 91( ,)1 33( 2)1 91( ,)1 33(-values of 1)2 485 6 764 7128 t (. . .)2 125 1 1563 7103 t (before plotting the data as)4 1069 1 1745 7128 t 10 I f (y)2847 7128 w 10 R f ( input to the second program has two values per)9 1983(-values. The)1 526 2 2891 7128 t (line, so they are interpreted as \()6 1255 1 720 7248 t 10 I f (x)1983 7248 w 10 R f (,)2035 7248 w 10 I f (y)2068 7248 w 10 R f (\) pairs.)1 277 1 2120 7248 t cleartomark showpage saveobj restore %%EndPage: 2 4 %%Page: 3 5 /saveobj save def mark 5 pagesetup 10 R f (- 3 -)2 166 1 2977 480 t ( The)1 212( line.)1 207(Rather than a scatter plot of points, we might prefer to see the winning times connected by a solid)18 4011 3 970 840 t (program)720 960 w 9 CW f (draw solid)1 540 1 1080 1130 t (copy "400mpairs.d")1 972 1 1080 1240 t 10 R f (produces the graph)2 759 1 720 1420 t 2082 1582 2082 3022 Dl 4242 1582 2082 1582 Dl 4242 3022 4242 1582 Dl 2082 3022 4242 3022 Dl 2297 3094 2297 3022 Dl (1900)2197 3204 w 3327 3094 3327 3022 Dl (1950)3227 3204 w 2010 2788 2082 2788 Dl (45)1885 2808 w 2010 2180 2082 2180 Dl (50)1885 2200 w 2296 2253 2214 1670 Dl 2379 2277 2297 2253 Dl 2461 2180 2379 2277 Dl 2543 2398 2461 2180 Dl 2708 2230 2544 2399 Dl 2791 2471 2709 2229 Dl 2873 2447 2791 2471 Dl 2956 2641 2874 2447 Dl 3038 2605 2956 2641 Dl 3284 2641 3038 2605 Dl 3368 2677 3286 2641 Dl 3450 2581 3368 2678 Dl 3532 2799 3450 2581 Dl 3615 2776 3533 2800 Dl 3697 2932 3615 2775 Dl 3779 2829 3697 2933 Dl 3861 2877 3779 2829 Dl 3944 2837 3862 2878 Dl 4026 2876 3944 2836 Dl 4108 2924 4026 2876 Dl ( ``Chari-)1 349( \(Remember)1 524(Eric Liddell of Great Britain won his gold medal in Paris in 1924 with a time of 47.6 seconds.)18 3807 3 720 3472 t (ots of Fire''?\))2 554 1 720 3592 t (We can make the graph more attractive by modifying its frame and adding labels.)13 3260 1 970 3748 t 9 CW f (frame invis ht 2 wid 3 left solid bot solid)9 2322 1 1080 3918 t (label left "Time" "\(in seconds\)")4 1728 1 1080 4028 t (label bot "Olympic 400 Meter Run: Winning Times")7 2592 1 1080 4138 t (draw solid)1 540 1 1080 4248 t (copy "400mpairs.d")1 972 1 1080 4358 t 10 R f (The)720 4538 w 10 CW f (frame)901 4538 w 10 R f ( the graph's bounding box: the overall frame \(which has four sides\) is invisible, it is)15 3382(command describes)1 791 2 1227 4538 t ( and bottom sides are)4 853(2 inches high and 3 inches wide \(which happen to be the default height and width\), and the left)18 3827 2 720 4658 t ( labels appear on the left and bottom, as requested.)9 2021( The)1 205(solid \(they could have been dashed or dotted instead\).)8 2149 3 720 4778 t 4500 6380 2340 6380 Dl 2340 4940 2340 6380 Dl 2555 6452 2555 6380 Dl (1900)2455 6562 w 3584 6452 3584 6380 Dl (1950)3484 6562 w 2268 6146 2340 6146 Dl (45)2143 6166 w 2268 5538 2340 5538 Dl (50)2143 5558 w (Time)1803 5620 w (\(in seconds\))1 485 1 1666 5740 t (Olympic 400 Meter Run: Winning Times)5 1658 1 2591 6700 t 2554 5611 2472 5028 Dl 2637 5635 2555 5611 Dl 2719 5538 2637 5635 Dl 2801 5756 2719 5538 Dl 2966 5588 2802 5757 Dl 3049 5829 2967 5587 Dl 3131 5805 3049 5829 Dl 3214 5999 3132 5805 Dl 3296 5963 3214 5999 Dl 3542 5999 3296 5963 Dl 3625 6035 3543 5999 Dl 3707 5939 3625 6036 Dl 3790 6157 3708 5939 Dl 3872 6134 3790 6158 Dl 3954 6290 3872 6133 Dl 4037 6187 3955 6291 Dl 4119 6235 4037 6187 Dl 4202 6195 4120 6236 Dl 4284 6234 4202 6194 Dl 4366 6282 4284 6234 Dl ( each axis,)2 424(To set the range of)4 756 2 970 6974 t 10 I f (grap)2178 6974 w 10 R f (examines the data and pads both dimensions by seven percent at each end.)12 3005 1 2395 6974 t (The)720 7094 w 10 CW f (coord)907 7094 w 10 R f ( the range of one or both axes explicitly; it also turns)11 2172(\(``coordinates''\) command allows you to specify)5 1989 2 1239 7094 t (off automatic padding.)2 907 1 720 7214 t cleartomark showpage saveobj restore %%EndPage: 3 5 %%Page: 4 6 /saveobj save def mark 6 pagesetup 10 R f (- 4 -)2 166 1 2977 480 t 9 CW f (frame invis ht 2 wid 3 left solid bot solid)9 2322 1 1080 890 t (label left "Time" "\(in seconds\)")4 1728 1 1080 1000 t (label bot "Olympic 400 Meter Run: Winning Times")7 2592 1 1080 1110 t (coord x 1894,1990 y 42,56)4 1350 1 1080 1220 t (draw solid)1 540 1 1080 1330 t (copy "400mpairs.d")1 972 1 1080 1440 t 10 R f (The)720 1620 w 10 I f (y)905 1620 w 10 R f ( ranges from 42 to 56 seconds \(a little more than before\), and the)13 2667(-axis now)1 396 2 949 1620 t 10 I f (x)4043 1620 w 10 R f (-axis from 1894 to 1990 \(a little)6 1313 1 4087 1620 t (less\).)720 1740 w 4500 3342 2340 3342 Dl 2340 1902 2340 3342 Dl 2475 3414 2475 3342 Dl (1900)2375 3524 w 2925 3414 2925 3342 Dl (1920)2825 3524 w 3375 3414 3375 3342 Dl (1940)3275 3524 w 3825 3414 3825 3342 Dl (1960)3725 3524 w 4275 3414 4275 3342 Dl (1980)4175 3524 w 2268 3033 2340 3033 Dl (45)2143 3053 w 2268 2519 2340 2519 Dl (50)2143 2539 w 2268 2004 2340 2004 Dl (55)2143 2024 w (Time)1803 2582 w (\(in seconds\))1 485 1 1666 2702 t (Olympic 400 Meter Run: Winning Times)5 1658 1 2591 3662 t 2475 2580 2385 2087 Dl 2565 2600 2475 2580 Dl 2655 2519 2565 2601 Dl 2745 2704 2655 2519 Dl 2925 2560 2745 2704 Dl 3015 2765 2925 2560 Dl 3105 2746 3015 2766 Dl 3195 2909 3105 2745 Dl 3285 2880 3195 2910 Dl 3555 2909 3285 2879 Dl 3645 2940 3555 2910 Dl 3735 2858 3645 2940 Dl 3825 3043 3735 2858 Dl 3915 3023 3825 3043 Dl 4005 3156 3915 3023 Dl 4095 3068 4005 3156 Dl 4185 3109 4095 3068 Dl 4275 3074 4185 3109 Dl 4365 3107 4275 3074 Dl 4455 3149 4365 3108 Dl ( preceding graphs were generated by)5 1489(The ticks in the)3 631 2 970 3936 t 10 I f (grap)3120 3936 w 10 R f ( you would rather)3 722( If)1 121(guessing at reasonable values.)3 1218 3 3339 3936 t (provide your own, you may use the)6 1412 1 720 4056 t 10 CW f (ticks)2157 4056 w 10 R f (command, which comes in the \257avors illustrated below.)7 2234 1 2482 4056 t 9 CW f (frame invis ht 2 wid 3 left solid bot solid)9 2322 1 1080 4226 t (label left "Time" "\(in seconds\)" left .2)6 2160 1 1080 4336 t (label bot "Olympic 400 Meter Run: Winning Times")7 2592 1 1080 4446 t (coord x 1894,1990 y 42, 56)5 1404 1 1080 4556 t (ticks left out at 44 "44", 46, 48 "48", 50, 52 "52", 54)12 2970 1 1080 4666 t (ticks bot in from 1900 to 1980 by 20)8 1944 1 1080 4776 t (draw solid)1 540 1 1080 4886 t (copy "400mpairs.d")1 972 1 1080 4996 t 10 R f (The \256rst)1 340 1 720 5176 t 10 CW f (ticks)1089 5176 w 10 R f ( facing out at the numbers in the list.)8 1503(command deals with the left axis: it puts the ticks)9 2016 2 1418 5176 t 10 I f (Grap)4992 5176 w 10 R f (puts)5233 5176 w ( given, each number serves as its own label, as)9 1869(labels only at values with strings, except that when no labels at all are)13 2811 2 720 5296 t (in the second)2 531 1 720 5416 t 10 CW f (ticks)1278 5416 w 10 R f ( command is for the bottom axis: it puts the ticks facing in at steps of 20 from)17 3141(command. That)1 654 2 1605 5416 t ( command)1 420( The)1 206( 1980.)1 251(1900 to)1 305 4 720 5536 t 10 CW f (ticks off)1 541 1 1928 5536 t 10 R f (turns off all ticks.)3 708 1 2495 5536 t 10 I f (Grap)3254 5536 w 10 R f (does its best to place labels appropriately, but it)8 1909 1 3491 5536 t (sometimes needs your help: the)4 1260 1 720 5656 t 10 CW f (left .2)1 420 1 2005 5656 t 10 R f (clause moves the left label 0.2 inches further left to avoid the new ticks.)13 2870 1 2450 5656 t cleartomark showpage saveobj restore %%EndPage: 4 6 %%Page: 5 7 /saveobj save def mark 7 pagesetup 10 R f (- 5 -)2 166 1 2977 480 t 4572 2280 2412 2280 Dl 2412 840 2412 2280 Dl (Time)1731 1520 w (\(in seconds\))1 485 1 1594 1640 t (Olympic 400 Meter Run: Winning Times)5 1658 1 2663 2600 t 2340 2074 2412 2074 Dl (44)2215 2094 w 2340 1868 2412 1868 Dl 2340 1662 2412 1662 Dl (48)2215 1682 w 2340 1457 2412 1457 Dl 2340 1251 2412 1251 Dl (52)2215 1271 w 2340 1045 2412 1045 Dl 2547 2208 2547 2280 Dl (1900)2447 2390 w 2997 2208 2997 2280 Dl (1920)2897 2390 w 3447 2208 3447 2280 Dl (1940)3347 2390 w 3897 2208 3897 2280 Dl (1960)3797 2390 w 4347 2208 4347 2280 Dl (1980)4247 2390 w 2547 1518 2457 1025 Dl 2637 1538 2547 1518 Dl 2727 1457 2637 1539 Dl 2817 1642 2727 1457 Dl 2997 1498 2817 1642 Dl 3087 1703 2997 1498 Dl 3177 1684 3087 1704 Dl 3267 1847 3177 1683 Dl 3357 1818 3267 1848 Dl 3627 1847 3357 1817 Dl 3717 1878 3627 1848 Dl 3807 1796 3717 1878 Dl 3897 1981 3807 1796 Dl 3987 1961 3897 1981 Dl 4077 2094 3987 1961 Dl 4167 2006 4077 2094 Dl 4257 2047 4167 2006 Dl 4347 2012 4257 2047 Dl 4437 2045 4347 2012 Dl 4527 2087 4437 2046 Dl (The \256le)1 316 1 970 2874 t 10 CW f (400wpairs.d)1319 2874 w 10 R f ( only since)2 451(contains the times for the women's 400 meter race, which has been run)12 2937 2 2012 2874 t (1964.)720 2994 w 9 CW f (1964 52)1 378 1 1080 3164 t (1968 52)1 378 1 1080 3274 t (1972 51.08)1 540 1 1080 3384 t (1976 49.29)1 540 1 1080 3494 t (1980 48.88)1 540 1 1080 3604 t (...)1080 3714 w (1988 48.65)1 540 1 1080 3824 t 10 R f (To add these times to the graph, we use)8 1578 1 720 4004 t 9 CW f (frame invis ht 2 wid 3 left solid bot solid)9 2322 1 1080 4174 t (label left "Time" "\(in seconds\)" left .2)6 2160 1 1080 4284 t (label bot "Olympic 400 Meter Run: Winning Times")7 2592 1 1080 4394 t (coord x 1894,1990 y 42, 56)5 1404 1 1080 4504 t (ticks left out at 44 "44", 46, 48 "48", 50, 52 "52", 54)12 2970 1 1080 4614 t (ticks bot in from 1900 to 1980 by 20)8 1944 1 1080 4724 t (draw solid)1 540 1 1080 4834 t (copy "400mpairs.d")1 972 1 1080 4944 t (new dotted)1 540 1 1080 5054 t (copy "400wpairs.d")1 972 1 1080 5164 t ("Women" size -3 at 1958,52)4 1404 1 1080 5274 t ("Men" size -3 at 1910,47)4 1296 1 1080 5384 t 10 R f (The)720 5564 w 10 CW f (new)903 5564 w 10 R f (command tells)1 589 1 1111 5564 t 10 I f (grap)1728 5564 w 10 R f ( start a new curve \(which in this case will be drawn with a)13 2372(to end the old curve and to)6 1083 2 1945 5564 t ( is placed on the graph by commands of the form)10 1958( Text)1 233(dotted line\).)1 483 3 720 5684 t 9 CW f ("string" at xvalue, yvalue)3 1404 1 1080 5854 t 10 R f (The)720 6034 w 10 CW f (size)900 6034 w 10 R f (clauses following the quoted strings tell)5 1596 1 1166 6034 t 10 I f (grap)2788 6034 w 10 R f (to shrink the characters by three points \(absolute point sizes)9 2397 1 3003 6034 t ( at the speci\256ed position, but can be adjusted by clauses to be)12 2546( are usually centered)3 849( Strings)1 343(may also be speci\256ed\).)3 942 4 720 6154 t (illustrated shortly.)1 728 1 720 6274 t cleartomark showpage saveobj restore %%EndPage: 5 7 %%Page: 6 8 /saveobj save def mark 8 pagesetup 10 R f (- 6 -)2 166 1 2977 480 t 4572 2280 2412 2280 Dl 2412 840 2412 2280 Dl (Time)1731 1520 w (\(in seconds\))1 485 1 1594 1640 t (Olympic 400 Meter Run: Winning Times)5 1658 1 2663 2600 t 2340 2074 2412 2074 Dl (44)2215 2094 w 2340 1868 2412 1868 Dl 2340 1662 2412 1662 Dl (48)2215 1682 w 2340 1457 2412 1457 Dl 2340 1251 2412 1251 Dl (52)2215 1271 w 2340 1045 2412 1045 Dl 2547 2208 2547 2280 Dl (1900)2447 2390 w 2997 2208 2997 2280 Dl (1920)2897 2390 w 3447 2208 3447 2280 Dl (1940)3347 2390 w 3897 2208 3897 2280 Dl (1960)3797 2390 w 4347 2208 4347 2280 Dl (1980)4247 2390 w 2547 1518 2457 1025 Dl 2637 1538 2547 1518 Dl 2727 1457 2637 1539 Dl 2817 1642 2727 1457 Dl 2997 1498 2817 1642 Dl 3087 1703 2997 1498 Dl 3177 1684 3087 1704 Dl 3267 1847 3177 1683 Dl 3357 1818 3267 1848 Dl 3627 1847 3357 1817 Dl 3717 1878 3627 1848 Dl 3807 1796 3717 1878 Dl 3897 1981 3807 1796 Dl 3987 1961 3897 1981 Dl 4077 2094 3987 1961 Dl 4167 2006 4077 2094 Dl 4257 2047 4167 2006 Dl 4347 2012 4257 2047 Dl 4437 2045 4347 2012 Dl 4527 2087 4437 2046 Dl 7 R f ( .)1 0(. . .)2 108 2 3977 1254 t (.)4089 1277 w (.)4112 1301 w (.)4134 1325 w (. .)1 18 1 4157 1349 t (.)4171 1379 w (.)4186 1410 w (.)4202 1441 w (.)4217 1471 w (.)4232 1502 w (. .)1 18 1 4247 1533 t (.)4276 1547 w (.)4307 1561 w (. .)1 18 1 4337 1575 t (.)4366 1577 w (.)4397 1578 w (. .)1 18 1 4427 1580 t (.)4456 1586 w (.)4487 1592 w (.)4517 1599 w (Women)3741 1271 w (Men)2708 1785 w 10 R f (The \256le)1 308 1 970 2874 t 10 CW f (phone.d)1303 2874 w 10 R f (records the number of telephones in the United States from 1900 to 1970.)12 2938 1 1748 2874 t 9 CW f (00 1.3)1 324 1 1080 3044 t (01 1.8)1 324 1 1080 3154 t (02 2.3)1 324 1 1080 3264 t (03 2.8)1 324 1 1080 3374 t (04 3.3)1 324 1 1080 3484 t (...)1080 3594 w (70 120.2)1 432 1 1080 3704 t 10 R f ( and the number of telephones present in that year \(in millions, truncated to the nearest hun-)16 3781(Each line gives a year)4 899 2 720 3884 t ( simple)1 292( The)1 205(dred thousand\).)1 621 3 720 4004 t 10 I f (grap)1863 4004 w 10 R f (program)2077 4004 w 9 CW f (copy "phone.d")1 756 1 1080 4174 t 10 R f (produces the simple graph)3 1051 1 720 4354 t 2106 4516 2106 5956 Dl 4266 4516 2106 4516 Dl 4266 5956 4266 4516 Dl 2106 5956 4266 5956 Dl 2238 6028 2238 5956 Dl (0)2213 6138 w 2779 6028 2779 5956 Dl (20)2729 6138 w 3321 6028 3321 5956 Dl (40)3271 6138 w 3862 6028 3862 5956 Dl (60)3812 6138 w 2034 5881 2106 5881 Dl (0)1959 5901 w 2034 5350 2106 5350 Dl (50)1909 5370 w 2034 4819 2106 4819 Dl (100)1859 4839 w 10 S f (\267)2215 5887 w (\267)2242 5882 w (\267)2269 5876 w (\267)2296 5871 w (\267)2324 5866 w (\267)2350 5857 w (\267)2378 5849 w (\267)2404 5836 w (\267)2432 5833 w (\267)2459 5828 w (\267)2486 5820 w (\267)2513 5813 w (\267)2540 5808 w (\267)2567 5800 w (\267)2594 5795 w (\267)2621 5789 w (\267)2648 5782 w (\267)2675 5777 w (\267)2702 5773 w (\267)2729 5767 w (\267)2756 5761 w (\267)2784 5754 w (\267)2810 5750 w (\267)2838 5739 w (\267)2864 5731 w (\267)2892 5722 w (\267)2919 5714 w (\267)2946 5706 w (\267)2973 5697 w (\267)3000 5690 w (\267)3027 5688 w (\267)3055 5693 w (\267)3081 5717 w (\267)3109 5724 w (\267)3135 5722 w (\267)3163 5716 w (\267)3190 5706 w (\267)3217 5695 w (\267)3244 5690 w (\267)3271 5680 w (\267)3298 5668 w (\267)3325 5652 w (\267)3352 5636 w (\267)3379 5621 w (\267)3406 5616 w (\267)3433 5605 w (\267)3461 5565 w (\267)3487 5531 w (\267)3515 5495 w (\267)3541 5469 w (\267)3569 5444 w (\267)3596 5417 w (\267)3623 5391 w (\267)3650 5366 w (\267)3677 5340 w (\267)3704 5304 w (\267)3731 5263 w (\267)3758 5225 w (\267)3785 5194 w (\267)3812 5149 w (\267)3839 5112 w (\267)3866 5078 w (\267)3893 5042 w (\267)3921 5004 w (\267)3947 4959 w (\267)3975 4906 w (\267)4001 4852 w (\267)4029 4799 w (\267)4056 4741 w (\267)4083 4677 w (\267)4110 4624 w 10 R f ( will plot the data with a logarithmic)7 1465(The number of telephones appears to grow exponentially; to study that we)11 2965 2 970 6442 t 10 I f (y)720 6562 w 10 R f (-axis by adding)2 634 1 764 6562 t 10 CW f (log y)1 273 1 1432 6562 t 10 R f (to the)1 233 1 1738 6562 t 10 CW f (coord)2004 6562 w 10 R f ( will also add cosmetic changes of labels, more ticks, and a)11 2448(command. We)1 615 2 2337 6562 t (solid line to replace the unconnected dots.)6 1678 1 720 6682 t cleartomark showpage saveobj restore %%EndPage: 6 8 %%Page: 7 9 /saveobj save def mark 9 pagesetup 10 R f (- 7 -)2 166 1 2977 480 t 9 CW f (label left "Millions of" "Telephones" "\(log scale\)" left .5)8 3186 1 1080 890 t (coord x 0,70 y 1,130 log y)6 1404 1 1080 1000 t (ticks left out at 1, 2, 5, 10, 20, 50, 100)10 2268 1 1080 1110 t (ticks bot out at 0 "1900", 70 "1970")7 1944 1 1080 1220 t (ticks bot out from 10 to 60 by 10 "'%g")9 2106 1 1080 1330 t (draw solid)1 540 1 1080 1440 t (copy "phone.d")1 756 1 1080 1550 t 10 R f (The third)1 370 1 720 1730 t 10 CW f (ticks)1116 1730 w 10 R f ( print the tick labels.)4 827(command provides a string that is used to)7 1670 2 1442 1730 t 9 R f (C)3991 1730 w 10 R f (programmers will recognize it as)4 1322 1 4078 1730 t (a)720 1850 w 10 CW f (printf)793 1850 w 10 R f (format string; others may view the)5 1399 1 1182 1850 t 10 CW f (%g)2610 1850 w 10 R f ( else \(in this case just)5 867(as the place to put the number and anything)8 1774 2 2759 1850 t ( pro-)1 196( The)1 210( suppress labels, use the empty format string \(""\).)8 2014( To)1 166( labels.)1 288(an apostrophe\) as literal text to appear in the)8 1806 6 720 1970 t (gram produces)1 590 1 720 2090 t 2495 2252 2495 3692 Dl 4655 2252 2495 2252 Dl 4655 3692 4655 2252 Dl 2495 3692 4655 3692 Dl (Millions of)1 448 1 1504 2872 t (Telephones)1498 2992 w (\(log scale\))1 418 1 1519 3112 t 2423 3692 2495 3692 Dl (1)2348 3712 w 2423 3486 2495 3486 Dl (2)2348 3506 w 2423 3216 2495 3216 Dl (5)2348 3236 w 2423 3010 2495 3010 Dl (10)2298 3030 w 2423 2805 2495 2805 Dl (20)2298 2825 w 2423 2534 2495 2534 Dl (50)2298 2554 w 2423 2329 2495 2329 Dl (100)2248 2349 w 2495 3764 2495 3692 Dl (1900)2395 3874 w 4655 3764 4655 3692 Dl (1970)4555 3874 w 2804 3764 2804 3692 Dl ('10)2738 3874 w 3112 3764 3112 3692 Dl ('20)3046 3874 w 3421 3764 3421 3692 Dl ('30)3355 3874 w 3730 3764 3730 3692 Dl ('40)3664 3874 w 4038 3764 4038 3692 Dl ('50)3972 3874 w 4347 3764 4347 3692 Dl ('60)4281 3874 w 2525 3518 2495 3614 Dl 2556 3445 2526 3517 Dl 2587 3387 2557 3445 Dl 2618 3339 2588 3387 Dl 2649 3274 2619 3338 Dl 2680 3222 2650 3274 Dl 2710 3157 2680 3221 Dl 2741 3143 2711 3157 Dl 2772 3120 2742 3142 Dl 2803 3092 2773 3120 Dl 2834 3067 2804 3092 Dl 2865 3052 2835 3065 Dl 2896 3026 2866 3051 Dl 2926 3011 2896 3026 Dl 2957 2996 2927 3010 Dl 2988 2977 2958 2996 Dl 3019 2965 2989 2977 Dl 3050 2957 3020 2964 Dl 3081 2942 3051 2956 Dl 3112 2929 3082 2942 Dl 3142 2916 3112 2928 Dl 3173 2907 3143 2915 Dl 3204 2885 3174 2907 Dl 3235 2872 3205 2884 Dl 3266 2857 3236 2871 Dl 3297 2844 3267 2857 Dl 3328 2831 3298 2843 Dl 3358 2818 3328 2830 Dl 3389 2807 3359 2817 Dl 3420 2805 3390 2807 Dl 3451 2811 3421 2804 Dl 3482 2847 3452 2811 Dl 3513 2860 3483 2848 Dl 3544 2858 3514 2861 Dl 3574 2847 3544 2857 Dl 3605 2830 3575 2846 Dl 3636 2815 3606 2830 Dl 3667 2808 3637 2815 Dl 3698 2795 3668 2807 Dl 3729 2779 3699 2794 Dl 3760 2759 3730 2779 Dl 3790 2741 3760 2758 Dl 3821 2725 3791 2740 Dl 3852 2720 3822 2725 Dl 3883 2709 3853 2719 Dl 3914 2670 3884 2708 Dl 3945 2642 3915 2670 Dl 3976 2615 3946 2642 Dl 4006 2596 3976 2614 Dl 4037 2579 4007 2595 Dl 4068 2562 4038 2579 Dl 4099 2546 4069 2561 Dl 4130 2533 4100 2546 Dl 4161 2518 4131 2532 Dl 4192 2500 4162 2518 Dl 4222 2480 4192 2500 Dl 4253 2464 4223 2480 Dl 4284 2450 4254 2463 Dl 4315 2432 4285 2450 Dl 4346 2418 4316 2432 Dl 4377 2405 4347 2417 Dl 4408 2393 4378 2405 Dl 4438 2380 4408 2392 Dl 4469 2365 4439 2379 Dl 4500 2350 4470 2365 Dl 4531 2334 4501 2349 Dl 4562 2319 4532 2333 Dl 4593 2303 4563 2318 Dl 4624 2288 4594 2303 Dl 4654 2276 4624 2288 Dl ( of telephones grew rapidly in the \256rst decade of this century, and then settled down to an exponential)18 4189(The number)1 491 2 720 4142 t (growth rate upset only by a decrease in the Great Depression and a post-war growth spurt to return the curve to its)21 4680 1 720 4262 t (pre-Depression line.)1 809 1 720 4382 t (Our presentation so far has been to start with a simple)10 2162 1 970 4538 t 10 I f (grap)3158 4538 w 10 R f ( data, and then re\256ne it.)5 950(program that illustrates the)3 1077 2 3373 4538 t ( we will ignore the design phase, and present rather complex graphs in their \256nal form.)15 3724(Later in this document)3 956 2 720 4658 t (Beware.)720 4778 w (All the examples so far have placed data on the graph implicitly by)12 2739 1 970 4934 t 10 CW f (copy)3739 4934 w 10 R f ( a time)2 284(ing a \256le of numbers \(either)5 1137 2 3979 4934 t ( The)1 215( is also possible to draw points and lines explicitly.)9 2129( It)1 121( of numbers\).)2 555(series with one number per line or pairs)7 1660 5 720 5054 t 10 I f (grap)720 5174 w 10 R f (commands to draw on a graph are illustrated in the following fragment.)11 2851 1 934 5174 t cleartomark showpage saveobj restore %%EndPage: 7 9 %%Page: 8 10 /saveobj save def mark 10 pagesetup 10 R f (- 8 -)2 166 1 2977 480 t 9 CW f (frame ht 2 wid 2)4 864 1 1080 890 t (coord x 0,100 y 0,100)4 1134 1 1080 1000 t (grid dotted bot from 20 to 80 by 20)8 1890 1 1080 1110 t (grid dotted left from 20 to 80 by 20)8 1944 1 1080 1220 t ( at 50,50)2 486( above)1 432("Text above")1 648 3 1080 1440 t ( rjust at 50,50)3 810( ")1 162("Text rjust)1 594 3 1080 1550 t (bullet at 80,90)2 810 1 1080 1660 t ( 80,80)1 324(vtick at)1 486 2 1080 1770 t ( \(80,70\))1 432(box at)1 486 2 1080 1880 t ( 80, 60)2 378(times at)1 486 2 1080 1990 t (circle at 50,50)2 810 1 1080 2210 t (circle at 50,80 radius .25)4 1404 1 1080 2320 t (line dashed from 10,90 to 30,90)5 1674 1 1080 2430 t (arrow from 10,70 to 30,90)4 1350 1 1080 2540 t (draw A solid)2 648 1 1080 2760 t (draw B dashed delta)3 1026 1 1080 2870 t (next A at 10,10)3 810 1 1080 2980 t (next B at 10,20)3 810 1 1080 3090 t (next A at 50,20)3 810 1 1080 3200 t (next A at 90,10)3 810 1 1080 3310 t (next B at 50,30)3 810 1 1080 3420 t (next B at 90,30)3 810 1 1080 3530 t 10 R f (The)970 3746 w 10 CW f (grid)1156 3746 w 10 R f (command is similar to the)4 1067 1 1428 3746 t 10 CW f (ticks)2527 3746 w 10 R f ( The)1 212(command, except that grid lines extend across the frame.)8 2329 2 2859 3746 t ( plotting characters \(such as)4 1138( The)1 211(next few commands plot text at speci\256ed positions.)7 2091 3 720 3866 t 10 CW f (bullet)4191 3866 w 10 R f (\) are implemented as)3 849 1 4551 3866 t ( centers of the markers are near)6 1310( arbitrary characters, the visual)4 1268( Unlike)1 331(prede\256ned macros \320 more on that shortly.)6 1771 4 720 3986 t ( The)1 212(their plotting centers.)2 866 2 720 4106 t 10 CW f (circle)1830 4106 w 10 R f ( radius in inches)3 670( A)1 128( circle centered at the speci\256ed location.)6 1640(command draws a)2 740 4 2222 4106 t ( The)1 209( shown at the center of the graph.)7 1358(may be speci\256ed; if no radius is given, then the circle will be the small circle)15 3113 3 720 4226 t 10 CW f (line)720 4346 w 10 R f (and)985 4346 w 10 CW f (arrow)1154 4346 w 10 R f (commands draw the obvious objects shown at the upper left.)9 2419 1 1479 4346 t 2388 4508 2388 5948 Dl 3828 4508 2388 4508 Dl 3828 5948 3828 4508 Dl 2388 5948 3828 5948 Dl 7 R f (.)2666 5951 w (.)2666 5915 w (.)2666 5879 w (.)2666 5843 w (.)2666 5807 w (.)2666 5771 w (.)2666 5735 w (.)2666 5699 w (.)2666 5663 w (.)2666 5627 w (.)2666 5591 w (.)2666 5555 w (.)2666 5519 w (.)2666 5483 w (.)2666 5447 w (.)2666 5411 w (.)2666 5375 w (.)2666 5339 w (.)2666 5303 w (.)2666 5267 w (.)2666 5231 w (.)2666 5195 w (.)2666 5159 w (.)2666 5123 w (.)2666 5087 w (.)2666 5051 w (.)2666 5015 w (.)2666 4979 w (.)2666 4943 w (.)2666 4907 w (.)2666 4871 w (.)2666 4835 w (.)2666 4799 w (.)2666 4763 w (.)2666 4727 w (.)2666 4691 w (.)2666 4655 w (.)2666 4619 w (.)2666 4583 w (.)2666 4547 w (.)2666 4511 w 10 R f (20)2626 6058 w 7 R f (.)2954 5951 w (.)2954 5915 w (.)2954 5879 w (.)2954 5843 w (.)2954 5807 w (.)2954 5771 w (.)2954 5735 w (.)2954 5699 w (.)2954 5663 w (.)2954 5627 w (.)2954 5591 w (.)2954 5555 w (.)2954 5519 w (.)2954 5483 w (.)2954 5447 w (.)2954 5411 w (.)2954 5375 w (.)2954 5339 w (.)2954 5303 w (.)2954 5267 w (.)2954 5231 w (.)2954 5195 w (.)2954 5159 w (.)2954 5123 w (.)2954 5087 w (.)2954 5051 w (.)2954 5015 w (.)2954 4979 w (.)2954 4943 w (.)2954 4907 w (.)2954 4871 w (.)2954 4835 w (.)2954 4799 w (.)2954 4763 w (.)2954 4727 w (.)2954 4691 w (.)2954 4655 w (.)2954 4619 w (.)2954 4583 w (.)2954 4547 w (.)2954 4511 w 10 R f (40)2914 6058 w 7 R f (.)3242 5951 w (.)3242 5915 w (.)3242 5879 w (.)3242 5843 w (.)3242 5807 w (.)3242 5771 w (.)3242 5735 w (.)3242 5699 w (.)3242 5663 w (.)3242 5627 w (.)3242 5591 w (.)3242 5555 w (.)3242 5519 w (.)3242 5483 w (.)3242 5447 w (.)3242 5411 w (.)3242 5375 w (.)3242 5339 w (.)3242 5303 w (.)3242 5267 w (.)3242 5231 w (.)3242 5195 w (.)3242 5159 w (.)3242 5123 w (.)3242 5087 w (.)3242 5051 w (.)3242 5015 w (.)3242 4979 w (.)3242 4943 w (.)3242 4907 w (.)3242 4871 w (.)3242 4835 w (.)3242 4799 w (.)3242 4763 w (.)3242 4727 w (.)3242 4691 w (.)3242 4655 w (.)3242 4619 w (.)3242 4583 w (.)3242 4547 w (.)3242 4511 w 10 R f (60)3202 6058 w 7 R f (.)3530 5951 w (.)3530 5915 w (.)3530 5879 w (.)3530 5843 w (.)3530 5807 w (.)3530 5771 w (.)3530 5735 w (.)3530 5699 w (.)3530 5663 w (.)3530 5627 w (.)3530 5591 w (.)3530 5555 w (.)3530 5519 w (.)3530 5483 w (.)3530 5447 w (.)3530 5411 w (.)3530 5375 w (.)3530 5339 w (.)3530 5303 w (.)3530 5267 w (.)3530 5231 w (.)3530 5195 w (.)3530 5159 w (.)3530 5123 w (.)3530 5087 w (.)3530 5051 w (.)3530 5015 w (.)3530 4979 w (.)3530 4943 w (.)3530 4907 w (.)3530 4871 w (.)3530 4835 w (.)3530 4799 w (.)3530 4763 w (.)3530 4727 w (.)3530 4691 w (.)3530 4655 w (.)3530 4619 w (.)3530 4583 w (.)3530 4547 w (.)3530 4511 w 10 R f (80)3490 6058 w 7 R f (. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .)40 1458 1 2378 5663 t 10 R f (20)2263 5680 w 7 R f (. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .)40 1458 1 2378 5375 t 10 R f (40)2263 5392 w 7 R f (. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .)40 1458 1 2378 5087 t 10 R f (60)2263 5104 w 7 R f (. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .)40 1458 1 2378 4799 t 10 R f (80)2263 4816 w (Text above)1 446 1 2885 5188 t (Text rjust)1 386 1 2672 5248 t 10 S f (\267)3517 4681 w (|)3530 4816 w 6 S1 f ()3525 4955 w cleartomark saveobj restore %%BeginGlobal /build_bx { pop size 2 div /side exch def currentpoint newpath moveto 0 side rlineto side 0 rlineto 0 side neg rlineto closepath fill } def %%EndGlobal /saveobj save def mark 6 S1 f 3525 4955 m 30 build_bx 3555 4955 m 7 S f (\264)3521 5104 w 7 S1 f ()3095 5248 w cleartomark saveobj restore %%BeginGlobal /build_ob { pop size 3 mul 16 div /rad exch def currentpoint newpath rad add exch rad add exch rad 0 360 arc stroke } def %%EndGlobal /saveobj save def mark 7 S1 f 3095 5248 m 27 build_ob 3122 5248 m 10 R f 2928 4796 360 360 De 2568 4652 2532 4652 Dl 2631 4652 2595 4652 Dl 2694 4652 2658 4652 Dl 2757 4652 2721 4652 Dl 2820 4652 2784 4652 Dl 2820 4652 2532 4940 Dl 2820 4652 2782 4715 Dl 2819 4652 2756 4690 Dl 7 S f (D)2511 5680 w 10 R f 3108 5660 2532 5804 Dl 3684 5804 3108 5660 Dl 2567 5652 2532 5660 Dl 2634 5635 2599 5643 Dl 2702 5618 2667 5626 Dl 2770 5601 2735 5609 Dl 2837 5584 2802 5592 Dl 2905 5567 2870 5575 Dl 2973 5550 2938 5558 Dl 3040 5533 3005 5541 Dl 3107 5516 3072 5524 Dl 7 S f (D)3087 5536 w 10 R f 3144 5516 3108 5516 Dl 3221 5516 3185 5516 Dl 3298 5516 3262 5516 Dl 3375 5516 3339 5516 Dl 3453 5516 3417 5516 Dl 3530 5516 3494 5516 Dl 3607 5516 3571 5516 Dl 3684 5516 3648 5516 Dl 7 S f (D)3663 5536 w 10 R f (This \256gure also illustrates the combined use of the)8 2127 1 970 6362 t 10 CW f (draw)3136 6362 w 10 R f (and)3415 6362 w 10 CW f (next)3599 6362 w 10 R f (commands. Saying)1 801 1 3879 6362 t 10 CW f (draw A solid)2 680 1 4720 6362 t 10 R f (de\256nes the style for a connected sequence of line fragments to be called)12 2949 1 720 6482 t 10 CW f (A)3701 6482 w 10 R f ( commands of)2 580(. Subsequent)1 543 2 3761 6482 t 10 CW f (next A at)2 484 1 4916 6482 t 10 I f (point)720 6602 w 10 R f (add)952 6602 w 10 I f (point)1123 6602 w 10 R f (to the end of)3 508 1 1356 6602 t 10 CW f (A)1891 6602 w 10 R f ( are two such sequences active in the above example \()10 2175(. There)1 309 2 1951 6602 t 10 CW f (A)4435 6602 w 10 R f (and)4522 6602 w 10 CW f (B)4693 6602 w 10 R f (\); note that their)3 647 1 4753 6602 t 10 CW f (next)720 6722 w 10 R f ( the prede\256ned string)3 858( Because)1 386(commands are intermixed.)2 1070 3 989 6722 t 10 CW f (delta)3332 6722 w 10 R f (follows the speci\256cation of)3 1097 1 3661 6722 t 10 CW f (B)4786 6722 w 10 R f (, that string is)3 554 1 4846 6722 t (plotted at each point in the sequence.)6 1478 1 720 6842 t 10 I f (Grap)970 6998 w 10 R f ( numbers\) and the usual collection)5 1378(has numeric variables \(implemented as double-precision \257oating point)7 2816 2 1206 6998 t (of arithmetic operators and mathematical functions; see the reference section for details.)11 3519 1 720 7118 t 10 I f (Grap)970 7274 w 10 R f (provides the same rudimentary macro facility that)6 1991 1 1206 7274 t 10 I f (pic)3222 7274 w 10 R f (does:)3369 7274 w cleartomark showpage saveobj restore %%EndPage: 8 10 %%Page: 9 11 /saveobj save def mark 11 pagesetup 10 R f (- 9 -)2 166 1 2977 480 t 9 CW f (define)1080 890 w 9 I f (name)1458 890 w 9 CW f ({)1761 890 w 9 I f (replacement text)1 598 1 1869 890 t 9 CW f (})2521 890 w 10 R f (de\256nes)720 1070 w 10 I f (name)1031 1070 w 10 R f (to be the)2 350 1 1283 1070 t 10 I f (replacement text)1 666 1 1662 1070 t 10 R f ( replacement may be any text that contains balanced open and closing)11 2830(. The)1 234 2 2336 1070 t (braces)720 1190 w 10 CW f ({ })1 185 1 1004 1190 t 10 R f ( the)1 152(. \(Alternatively,)1 665 2 1189 1190 t 10 I f (replacement text)1 667 1 2036 1190 t 10 R f (may be quoted by any single character that does not appear in the)12 2659 1 2741 1190 t ( subsequent occurrence of)3 1050( Any)1 225(replacement; the string is terminated by the next occurrence of that character.\))11 3152 3 720 1310 t 10 I f (name)5176 1310 w 10 R f (will be replaced by)3 762 1 720 1430 t 10 I f (replacement text)1 662 1 1507 1430 t 10 R f (.)2177 1430 w ( text of a macro de\256nition may contain occurrences of)9 2186(The replacement)1 669 2 970 1586 t 10 CW f ($1)3853 1586 w 10 R f (,)3973 1586 w 10 CW f ($2)4026 1586 w 10 R f (, etc.; these will be replaced by)6 1254 1 4146 1586 t ( invocation for a macro with arguments is)7 1667( The)1 205(the corresponding actual arguments when the macro is invoked.)8 2548 3 720 1706 t 9 CW f (name\(arg1, arg2, ...\))2 1134 1 1080 1876 t 10 R f (Non-existent arguments are replaced by null strings.)6 2088 1 720 2056 t (The following)1 569 1 970 2212 t 10 I f (grap)1564 2212 w 10 R f ( to plot crude approximations to the square and square)9 2175(program uses macros and arithmetic)4 1447 2 1778 2212 t (root functions.)1 583 1 720 2332 t 9 CW f (frame ht 1.5 wid 1.5)4 1080 1 1080 2502 t (define square { \($1\)*\($1\) })4 1458 1 1080 2612 t (define root { \($1\3030.5\) })4 1296 1 1080 2722 t (define P {)2 540 1 1080 2832 t (times at i, square\(i\); i = i+1)6 1620 1 1512 2942 t (circle at j, root\(j\); j = j+5)6 1566 1 1512 3052 t (})1080 3162 w (i = 1; j = 5)5 648 1 1080 3272 t (P; P; P; P; P)4 702 1 1080 3382 t 10 R f (The macro)1 432 1 720 3562 t 10 CW f (root)1180 3562 w 10 R f (uses the)1 322 1 1448 3562 t 10 CW f (\303)1798 3562 w 10 R f ( \(Because)1 418(exponentiation operator.)1 979 2 1886 3562 t 10 I f (grap)3311 3562 w 10 R f (has the square root function)4 1121 1 3528 3562 t 10 CW f (sqrt)4678 3562 w 10 R f (, that macro)2 482 1 4918 3562 t ( program produces)2 748( The)1 205(is in fact super\257uous.\))3 888 3 720 3682 t 2622 3844 2622 4924 Dl 3702 3844 2622 3844 Dl 3702 4924 3702 3844 Dl 2622 4924 3702 4924 Dl 2648 4996 2648 4924 Dl (0)2623 5106 w 2846 4996 2846 4924 Dl (5)2821 5106 w 3044 4996 3044 4924 Dl (10)2994 5106 w 3241 4996 3241 4924 Dl (15)3191 5106 w 3438 4996 3438 4924 Dl (20)3388 5106 w 3635 4996 3635 4924 Dl (25)3585 5106 w 2550 4897 2622 4897 Dl (0)2475 4917 w 2550 4700 2622 4700 Dl (5)2475 4720 w 2550 4502 2622 4502 Dl (10)2425 4522 w 2550 4304 2622 4304 Dl (15)2425 4324 w 2550 4107 2622 4107 Dl (20)2425 4127 w 2550 3910 2622 3910 Dl (25)2425 3930 w 7 S f (\264)2669 4877 w 7 S1 f ()2833 4828 w 2833 4828 m 27 build_ob 2860 4828 m 7 S f (\264)2709 4758 w 7 S1 f ()3031 4792 w 3031 4792 m 27 build_ob 3058 4792 m 7 S f (\264)2748 4561 w 7 S1 f ()3228 4764 w 3228 4764 m 27 build_ob 3255 4764 m 7 S f (\264)2788 4285 w 7 S1 f ()3425 4740 w 3425 4740 m 27 build_ob 3452 4740 m 7 S f (\264)2827 3930 w 7 S1 f ()3622 4720 w 3622 4720 m 27 build_ob 3649 4720 m 10 R f (The)970 5410 w 10 CW f (copy)1159 5410 w 10 R f (command has a)2 639 1 1433 5410 t 10 CW f (thru)2107 5410 w 10 R f (parameter that allows each line of a \256le to be treated as though it were a)15 3018 1 2382 5410 t ( is the typical)3 545( This)1 231( on.)1 153(macro call, with the \256rst \256eld serving as the \256rst argument, and so)12 2690 4 720 5530 t 10 I f (grap)4367 5530 w 10 R f (mechanism for plot-)2 816 1 4584 5530 t ( stored as time series or as \()7 1134(ting \256les that are not)4 834 2 720 5650 t 10 I f (x)2696 5650 w 10 R f (,)2748 5650 w 10 I f (y)2781 5650 w 10 R f ( will illustrate its use on the \256le)7 1287( We)1 192(\) pairs.)1 281 3 2833 5650 t 10 CW f (states.d)4622 5650 w 10 R f (, which)1 298 1 5102 5650 t (contains data on the \256fty states.)5 1260 1 720 5770 t 9 CW f ( 401851)1 702(AK 1)1 486 2 1080 5940 t ( 469557)1 702(WY 1)1 486 2 1080 6050 t ( 511456)1 702(VT 1)1 486 2 1080 6160 t ( 594338)1 702(DE 1)1 486 2 1080 6270 t ( 652717)1 702(ND 1)1 486 2 1080 6380 t (...)1080 6490 w (CA 45 23667902)2 1296 1 1080 6600 t 10 R f ( is the postal abbreviation of the state's name \(Alaska, Wyoming, Vermont, ...\), the second \256eld is the)17 4135(The \256rst \256eld)2 545 2 720 6780 t ( popu-)1 258(number of Representatives to Congress from the state after the 1981 reapportionment, and the third \256eld is the)17 4422 2 720 6900 t ( states appear in increasing order of population.)7 1896( The)1 205(lation of the state as measured in the 1980 Census.)9 2020 3 720 7020 t ( the)1 153( \(In)1 172( pairs.)1 250(We will \256rst plot this data as population, representative)8 2252 4 970 7176 t 10 CW f (coord)3828 7176 w 10 R f (statement,)4159 7176 w 10 CW f (log log)1 426 1 4598 7176 t 10 R f (is a syn-)2 345 1 5055 7176 t (onym for)1 369 1 720 7296 t 10 CW f (log x log y)3 660 1 1114 7296 t 10 R f (.\))1774 7296 w cleartomark showpage saveobj restore %%EndPage: 9 11 %%Page: 10 12 /saveobj save def mark 12 pagesetup 10 R f (- 10 -)2 216 1 2952 480 t 9 CW f (label left "Representatives" "to Congress" left .3)6 2700 1 1080 890 t (label bot "Population \(Millions\)")3 1782 1 1080 1000 t (coord x .3,30 y .8,50 log log)6 1566 1 1080 1110 t (define PlotState { circle at \($3/1e6,$2\) })6 2268 1 1080 1220 t (copy "states.d" thru PlotState)3 1620 1 1080 1330 t 10 R f ( the)1 148(Although the population is given in persons,)6 1775 2 720 1510 t 10 CW f (PlotState)2669 1510 w 10 R f (macro plots the population in millions by dividing the)8 2165 1 3235 1510 t (third input \256eld by one million \(written in exponential notation as)10 2628 1 720 1630 t 10 CW f (1e6)3373 1630 w 10 R f (, for 1)2 241 1 3553 1630 t 10 S f (\264)3802 1630 w 10 R f (10)3865 1630 w 7 R f (6)3970 1590 w 10 R f (\).)4013 1630 w 2395 1815 2395 3255 Dl 4555 1815 2395 1815 Dl 4555 3255 4555 1815 Dl 2395 3255 4555 3255 Dl 2959 3327 2959 3255 Dl (1)2934 3437 w 4039 3327 4039 3255 Dl (10)3989 3437 w 2323 3177 2395 3177 Dl (1)2248 3197 w 2323 2936 2395 2936 Dl (2)2248 2956 w 2323 2617 2395 2617 Dl (5)2248 2637 w 2323 2375 2395 2375 Dl (10)2198 2395 w 2323 2134 2395 2134 Dl (20)2198 2154 w 2323 1815 2395 1815 Dl (50)2198 1835 w (Representatives)1359 2495 w (to Congress)1 475 1 1438 2615 t (Population \(Millions\))1 865 1 3043 3575 t 7 S1 f ()2518 3197 w 2518 3197 m 27 build_ob 2545 3197 m ()2592 3197 w 2592 3197 m 27 build_ob 2619 3197 m ()2632 3197 w 2632 3197 m 27 build_ob 2659 3197 m ()2702 3197 w 2702 3197 m 27 build_ob 2729 3197 m ()2746 3197 w 2746 3197 m 27 build_ob 2773 3197 m ()2772 3197 w 2772 3197 m 27 build_ob 2799 3197 m ()2834 2956 w 2834 2956 m 27 build_ob 2861 2956 m ()2842 2956 w 2842 2956 m 27 build_ob 2869 2956 m ()2907 2956 w 2907 2956 m 27 build_ob 2934 2956 m ()2919 2956 w 2919 2956 m 27 build_ob 2946 2956 m ()2921 2956 w 2921 2956 m 27 build_ob 2948 2956 m ()2929 2956 w 2929 2956 m 27 build_ob 2956 2956 m ()3001 2956 w 3001 2956 m 27 build_ob 3028 2956 m ()3071 2814 w 3071 2814 m 27 build_ob 3098 2814 m ()3124 2814 w 3124 2814 m 27 build_ob 3151 2814 m ()3158 2814 w 3158 2814 m 27 build_ob 3185 2814 m ()3259 2714 w 3259 2714 m 27 build_ob 3286 2714 m ()3334 2714 w 3334 2714 m 27 build_ob 3361 2714 m ()3350 2637 w 3350 2637 m 27 build_ob 3377 2637 m ()3380 2637 w 3380 2637 m 27 build_ob 3407 2637 m ()3400 2637 w 3400 2637 m 27 build_ob 3427 2637 m ()3415 2637 w 3415 2637 m 27 build_ob 3442 2637 m ()3444 2573 w 3444 2573 m 27 build_ob 3471 2573 m ()3448 2573 w 3448 2573 m 27 build_ob 3475 2573 m ()3465 2573 w 3465 2573 m 27 build_ob 3492 2573 m ()3478 2573 w 3478 2573 m 27 build_ob 3505 2573 m ()3480 2573 w 3480 2573 m 27 build_ob 3507 2573 m ()3555 2519 w 3555 2519 m 27 build_ob 3582 2519 m ()3584 2519 w 3584 2519 m 27 build_ob 3611 2519 m ()3606 2473 w 3606 2473 m 27 build_ob 3633 2473 m ()3612 2473 w 3612 2473 m 27 build_ob 3639 2473 m ()3620 2473 w 3620 2473 m 27 build_ob 3647 2473 m ()3621 2473 w 3621 2473 m 27 build_ob 3648 2473 m ()3661 2432 w 3661 2432 m 27 build_ob 3688 2432 m ()3672 2432 w 3672 2432 m 27 build_ob 3699 2432 m ()3693 2432 w 3693 2432 m 27 build_ob 3720 2432 m ()3732 2395 w 3732 2395 m 27 build_ob 3759 2395 m ()3742 2395 w 3742 2395 m 27 build_ob 3769 2395 m ()3745 2395 w 3745 2395 m 27 build_ob 3772 2395 m ()3765 2362 w 3765 2362 m 27 build_ob 3792 2362 m ()3778 2362 w 3778 2362 m 27 build_ob 3805 2362 m ()3883 2278 w 3883 2278 m 27 build_ob 3910 2278 m ()3990 2191 w 3990 2191 m 27 build_ob 4017 2191 m ()4014 2172 w 4014 2172 m 27 build_ob 4041 2172 m ()4062 2137 w 4062 2137 m 27 build_ob 4089 2137 m ()4089 2120 w 4089 2120 m 27 build_ob 4116 2120 m ()4107 2105 w 4107 2105 m 27 build_ob 4134 2105 m ()4192 2049 w 4192 2049 m 27 build_ob 4219 2049 m ()4290 1969 w 4290 1969 m 27 build_ob 4317 1969 m ()4431 1871 w 4431 1871 m 27 build_ob 4458 1871 m 10 R f (Using)720 3813 w 10 CW f (circle)985 3813 w 10 R f ( that are obscured when the data is plotted with bul-)10 2089(as a plotting symbol displays overlapping points)6 1940 2 1371 3813 t ( representation of a state is roughly proportional to its population, except in the very small states.)16 3874(lets. The)1 369 2 720 3933 t (Our next plot will use the state's rank in population as the)11 2334 1 970 4089 t 10 I f (x)3331 4089 w 10 R f (-coordinate and two different)3 1172 1 3375 4089 t 10 I f (y)4574 4089 w 10 R f (-coordinates: popu-)1 782 1 4618 4089 t ( will use two)3 520( We)1 190(lation and number of representatives.)4 1491 3 720 4209 t 10 CW f (coord)2947 4209 w 10 R f (commands to de\256ne the two coordinate systems)6 1921 1 3273 4209 t 10 CW f (pop)5220 4209 w 10 R f (and)720 4329 w 10 CW f (rep)890 4329 w 10 R f ( then explicitly give the coordinate system whenever we refer to a point, both in constructing axes and)17 4116(. We)1 214 2 1070 4329 t (plotting data.)1 528 1 720 4449 t 9 CW f (frame ht 3 wid 3.5)4 972 1 1080 4619 t (label left "Population" "in Millions" "\(Plotted as \\\(bu\)")7 3078 1 1080 4729 t (label bot "Rank In Population" up .2)6 1944 1 1080 4839 t (label right "Representatives" "\(Plotted as \\\(sq\)")5 2646 1 1080 4949 t (coord pop x 0,51 y .2,30 log y)7 1620 1 1080 5059 t (coord rep x 0,51 y .3,100 log y)7 1674 1 1080 5169 t (ticks left out at pop .3, 1, 3, 10, 30)9 2052 1 1080 5279 t (ticks bot out at pop 1, 50)6 1404 1 1080 5389 t (ticks right out at rep 1, 3, 10, 30, 100)9 2160 1 1080 5499 t (thisrank = 50)2 702 1 1080 5609 t (copy "states.d" thru {)3 1188 1 1080 5719 t (bullet at pop thisrank,$3/1e6)3 1566 1 1512 5829 t (square at rep thisrank,$2)3 1350 1 1512 5939 t (thisrank = thisrank - 1)4 1242 1 1512 6049 t (})1080 6159 w 10 R f (The)720 6339 w 10 CW f (copy)905 6339 w 10 R f (statement in the program uses an)5 1337 1 1175 6339 t 10 I f (immediate macro)1 701 1 2542 6339 t 10 R f ( to)1 109(enclosed in curly brackets and thus avoids having)7 2018 2 3273 6339 t ( the program assumes that the states are sorted in increasing order of population,)13 3211( Because)1 383(name a macro for this task.)5 1086 3 720 6459 t (it generates)1 457 1 720 6579 t 10 CW f (thisrank)1202 6579 w 10 R f (internally as a)2 560 1 1707 6579 t 10 I f (grap)2292 6579 w 10 R f ( program produces)2 748(variable. The)1 551 2 2506 6579 t cleartomark showpage saveobj restore %%EndPage: 10 12 %%Page: 11 13 /saveobj save def mark 13 pagesetup 10 R f (- 11 -)2 216 1 2952 480 t 1799 899 1799 3059 Dl 4319 899 1799 899 Dl 4319 3059 4319 899 Dl 1799 3059 4319 3059 Dl (Population)1031 1879 w (in Millions)1 443 1 1027 1999 t (\(Plotted as)1 425 1 984 2119 t 10 S f (\267)1434 2119 w 10 R f (\))1480 2119 w (Rank In Population)2 778 1 2670 3236 t (Representatives)4556 1939 w (\(Plotted as)1 425 1 4606 2059 t 10 S1 f ()5056 2059 w cleartomark saveobj restore %%BeginGlobal /build_sq { pop size 2 div /side exch def currentpoint newpath moveto 0 side rlineto side 0 rlineto 0 side neg rlineto closepath font B eq {fill} {stroke} ifelse } def %%EndGlobal /saveobj save def mark 10 S1 f 5056 2059 m 50 build_sq 5106 2059 m 10 R f (\))5106 2059 w 1727 2885 1799 2885 Dl (0.3)1577 2905 w 1727 2366 1799 2366 Dl (1)1652 2386 w 1727 1892 1799 1892 Dl (3)1652 1912 w 1727 1373 1799 1373 Dl (10)1602 1393 w 1727 899 1799 899 Dl (30)1602 919 w 1849 3131 1849 3059 Dl (1)1824 3241 w 4270 3131 4270 3059 Dl (50)4220 3241 w 4391 2612 4319 2612 Dl (1)4416 2632 w 4391 2203 4319 2203 Dl (3)4416 2223 w 4391 1755 4319 1755 Dl (10)4416 1775 w 4391 1347 4319 1347 Dl (30)4416 1367 w 4391 899 4319 899 Dl (100)4416 919 w 10 S f (\267)4247 2788 w 7 S1 f ()4253 2629 w 4253 2629 m 35 build_sq 4288 2629 m 10 S f (\267)4198 2720 w 7 S1 f ()4204 2629 w 4204 2629 m 35 build_sq 4239 2629 m 10 S f (\267)4148 2684 w 7 S1 f ()4154 2629 w 4154 2629 m 35 build_sq 4189 2629 m 10 S f (\267)4099 2619 w 7 S1 f ()4105 2629 w 4105 2629 m 35 build_sq 4140 2629 m 10 S f (\267)4049 2579 w 7 S1 f ()4055 2629 w 4055 2629 m 35 build_sq 4090 2629 m 10 S f (\267)4000 2554 w 7 S1 f ()4006 2629 w 4006 2629 m 35 build_sq 4041 2629 m 10 S f (\267)3951 2498 w 7 S1 f ()3957 2371 w 3957 2371 m 35 build_sq 3992 2371 m 10 S f (\267)3901 2491 w 7 S1 f ()3907 2371 w 3907 2371 m 35 build_sq 3942 2371 m 10 S f (\267)3852 2430 w 7 S1 f ()3858 2371 w 3858 2371 m 35 build_sq 3893 2371 m 10 S f (\267)3802 2419 w 7 S1 f ()3808 2371 w 3808 2371 m 35 build_sq 3843 2371 m 10 S f (\267)3753 2418 w 7 S1 f ()3759 2371 w 3759 2371 m 35 build_sq 3794 2371 m 10 S f (\267)3704 2410 w 7 S1 f ()3710 2371 w 3710 2371 m 35 build_sq 3745 2371 m 10 S f (\267)3654 2344 w 7 S1 f ()3660 2371 w 3660 2371 m 35 build_sq 3695 2371 m 10 S f (\267)3605 2280 w 7 S1 f ()3611 2220 w 3611 2220 m 35 build_sq 3646 2220 m 10 S f (\267)3555 2231 w 7 S1 f ()3561 2220 w 3561 2220 m 35 build_sq 3596 2220 m 10 S f (\267)3506 2201 w 7 S1 f ()3512 2220 w 3512 2220 m 35 build_sq 3547 2220 m 10 S f (\267)3457 2107 w 7 S1 f ()3463 2114 w 3463 2114 m 35 build_sq 3498 2114 m 10 S f (\267)3407 2039 w 7 S1 f ()3413 2114 w 3413 2114 m 35 build_sq 3448 2114 m 10 S f (\267)3357 2024 w 7 S1 f ()3363 2030 w 3363 2030 m 35 build_sq 3398 2030 m 10 S f (\267)3308 1996 w 7 S1 f ()3314 2030 w 3314 2030 m 35 build_sq 3349 2030 m 10 S f (\267)3259 1977 w 7 S1 f ()3265 2030 w 3265 2030 m 35 build_sq 3300 2030 m 10 S f (\267)3210 1964 w 7 S1 f ()3216 2030 w 3216 2030 m 35 build_sq 3251 2030 m 10 S f (\267)3160 1937 w 7 S1 f ()3166 1962 w 3166 1962 m 35 build_sq 3201 1962 m 10 S f (\267)3110 1933 w 7 S1 f ()3116 1962 w 3116 1962 m 35 build_sq 3151 1962 m 10 S f (\267)3061 1918 w 7 S1 f ()3067 1962 w 3067 1962 m 35 build_sq 3102 1962 m 10 S f (\267)3012 1906 w 7 S1 f ()3018 1962 w 3018 1962 m 35 build_sq 3053 1962 m 10 S f (\267)2962 1904 w 7 S1 f ()2968 1962 w 2968 1962 m 35 build_sq 3003 1962 m 10 S f (\267)2913 1835 w 7 S1 f ()2919 1906 w 2919 1906 m 35 build_sq 2954 1906 m 10 S f (\267)2863 1809 w 7 S1 f ()2869 1906 w 2869 1906 m 35 build_sq 2904 1906 m 10 S f (\267)2815 1789 w 7 S1 f ()2821 1856 w 2821 1856 m 35 build_sq 2856 1856 m 10 S f (\267)2765 1783 w 7 S1 f ()2771 1856 w 2771 1856 m 35 build_sq 2806 1856 m 10 S f (\267)2715 1776 w 7 S1 f ()2721 1856 w 2721 1856 m 35 build_sq 2756 1856 m 10 S f (\267)2666 1774 w 7 S1 f ()2672 1856 w 2672 1856 m 35 build_sq 2707 1856 m 10 S f (\267)2617 1738 w 7 S1 f ()2623 1812 w 2623 1812 m 35 build_sq 2658 1812 m 10 S f (\267)2567 1727 w 7 S1 f ()2573 1812 w 2573 1812 m 35 build_sq 2608 1812 m 10 S f (\267)2518 1708 w 7 S1 f ()2524 1812 w 2524 1812 m 35 build_sq 2559 1812 m 10 S f (\267)2468 1672 w 7 S1 f ()2474 1772 w 2474 1772 m 35 build_sq 2509 1772 m 10 S f (\267)2419 1663 w 7 S1 f ()2425 1772 w 2425 1772 m 35 build_sq 2460 1772 m 10 S f (\267)2370 1661 w 7 S1 f ()2376 1772 w 2376 1772 m 35 build_sq 2411 1772 m 10 S f (\267)2320 1642 w 7 S1 f ()2326 1737 w 2326 1737 m 35 build_sq 2361 1737 m 10 S f (\267)2271 1631 w 7 S1 f ()2277 1737 w 2277 1737 m 35 build_sq 2312 1737 m 10 S f (\267)2221 1534 w 7 S1 f ()2227 1648 w 2227 1648 m 35 build_sq 2262 1648 m 10 S f (\267)2172 1435 w 7 S1 f ()2178 1554 w 2178 1554 m 35 build_sq 2213 1554 m 10 S f (\267)2123 1413 w 7 S1 f ()2129 1534 w 2129 1534 m 35 build_sq 2164 1534 m 10 S f (\267)2073 1369 w 7 S1 f ()2079 1497 w 2079 1497 m 35 build_sq 2114 1497 m 10 S f (\267)2023 1344 w 7 S1 f ()2029 1479 w 2029 1479 m 35 build_sq 2064 1479 m 10 S f (\267)1974 1329 w 7 S1 f ()1980 1463 w 1980 1463 m 35 build_sq 2015 1463 m 10 S f (\267)1925 1250 w 7 S1 f ()1931 1404 w 1931 1404 m 35 build_sq 1966 1404 m 10 S f (\267)1876 1159 w 7 S1 f ()1882 1317 w 1882 1317 m 35 build_sq 1917 1317 m 10 S f (\267)1826 1031 w 7 S1 f ()1832 1214 w 1832 1214 m 35 build_sq 1867 1214 m 10 R f ( graph also indicates that repre-)5 1260( This)1 229(The plotting symbols were chosen for contrast in both shape and shading.)11 2941 3 970 3545 t ( we see this graph, though, we should realize that we don't really need)13 2847( Once)1 264(sentation is proportional to population.)4 1569 3 720 3665 t ( \320 about 226,000,000 \320 by the)6 1300(two coordinate systems: we can relate the two by dividing the population of the U.S.)14 3380 2 720 3785 t ( the purpose)2 496( If)1 120( representative should count as 520,000 people.)6 1921(number of representatives \320 435 \320 to see that each)9 2143 4 720 3905 t ( coordinate systems, it)3 936(of this graph were to tell a story about American politics rather than to illustrate multiple)15 3744 2 720 4025 t (should be redrawn with a single coordinate system.)7 2047 1 720 4145 t ( are many)2 413( There)1 292( \(theoretically\) describes the data.)4 1389(Many graphs plot both observed data and a function that)9 2336 4 970 4301 t (ways to draw a function in)5 1067 1 720 4421 t 10 I f (grap)1813 4421 w 10 R f (: a series of)3 460 1 2002 4421 t 10 CW f (next)2488 4421 w 10 R f ( writing a simple program)4 1038(commands is tedious but works, as does)6 1608 2 2754 4421 t (to write a data \256le that is subsequently read and plotted by)11 2328 1 720 4541 t 10 I f (grap)3073 4541 w 10 R f (. The)1 230 1 3262 4541 t 10 CW f (for)3517 4541 w 10 R f ( better solution.)2 627(statement often provides a)3 1051 2 3722 4541 t (This)720 4661 w 10 I f (grap)923 4661 w 10 R f (program)1137 4661 w 9 CW f (frame ht 1 wid 3)4 864 1 1080 4831 t (draw solid)1 540 1 1080 4941 t (pi = atan2\(0,-1\))2 864 1 1080 5051 t (for i from 0 to 2*pi by .1 do { next at i, sin\(i\) })14 2754 1 1080 5161 t 10 R f (produces)720 5341 w 2154 5503 2154 6223 Dl 4314 5503 2154 5503 Dl 4314 6223 4314 5503 Dl 2154 6223 4314 6223 Dl 2286 6295 2286 6223 Dl (0)2261 6405 w 2897 6295 2897 6223 Dl (2)2872 6405 w 3509 6295 3509 6223 Dl (4)3484 6405 w 4120 6295 4120 6223 Dl (6)4095 6405 w 2082 6179 2154 6179 Dl (\2611)1957 6199 w 2082 6020 2154 6020 Dl (\2610.5)1882 6040 w 2082 5863 2154 5863 Dl (0)2007 5883 w 2082 5705 2154 5705 Dl (0.5)1932 5725 w 2082 5546 2154 5546 Dl (1)2007 5566 w 2316 5832 2286 5863 Dl 2347 5801 2317 5831 Dl 2377 5770 2347 5800 Dl 2408 5740 2378 5769 Dl 2439 5711 2409 5739 Dl 2469 5685 2439 5711 Dl 2500 5659 2470 5684 Dl 2530 5636 2500 5659 Dl 2561 5616 2531 5636 Dl 2591 5597 2561 5615 Dl 2622 5582 2592 5597 Dl 2652 5569 2622 5581 Dl 2683 5558 2653 5568 Dl 2714 5551 2684 5558 Dl 2744 5548 2714 5551 Dl 2775 5547 2745 5547 Dl 2805 5548 2775 5546 Dl 2836 5554 2806 5549 Dl 2866 5563 2836 5555 Dl 2897 5575 2867 5564 Dl 2927 5589 2897 5575 Dl 2958 5607 2928 5590 Dl 2989 5627 2959 5607 Dl 3019 5649 2989 5627 Dl 3050 5673 3020 5649 Dl 3080 5698 3050 5673 Dl 3111 5728 3081 5700 Dl 3141 5756 3111 5727 Dl 3172 5787 3142 5757 Dl 3203 5817 3173 5787 Dl 3233 5849 3203 5818 Dl 3264 5881 3234 5850 Dl 3294 5912 3264 5881 Dl 3325 5942 3295 5912 Dl 3355 5973 3325 5943 Dl 3386 6001 3356 5973 Dl 3416 6029 3386 6002 Dl 3447 6055 3417 6030 Dl 3478 6078 3448 6055 Dl 3509 6101 3479 6080 Dl 3539 6121 3509 6102 Dl 3569 6137 3539 6121 Dl 3600 6152 3570 6138 Dl 3630 6163 3600 6152 Dl 3661 6170 3631 6163 Dl 3691 6176 3661 6171 Dl 3722 6178 3692 6176 Dl 3753 6178 3723 6179 Dl 3784 6173 3754 6177 Dl 3814 6166 3784 6173 Dl 3844 6156 3814 6166 Dl 3875 6142 3845 6155 Dl 3905 6127 3875 6142 Dl 3936 6107 3906 6125 Dl 3966 6087 3936 6107 Dl 3997 6062 3967 6085 Dl 4028 6037 3998 6062 Dl 4059 6010 4029 6037 Dl 4089 5981 4059 6009 Dl 4119 5952 4089 5981 Dl 4150 5921 4120 5951 Dl 4180 5890 4150 5920 Dl (The)720 6673 w 10 CW f (for)904 6673 w 10 R f ( as the)2 265(statement uses the same syntax)4 1259 2 1113 6673 t 10 CW f (ticks)2667 6673 w 10 R f (statement, but the)2 718 1 2997 6673 t 10 CW f (from)3745 6673 w 10 R f (keyword can be replaced by ``)5 1234 1 4015 6673 t 10 CW f (=)5249 6673 w 10 R f ('',)5309 6673 w ( variable over the speci\256ed range and for each)8 1918( varies the index)3 690( It)1 122(which will look more familiar to programmers.)6 1950 4 720 6793 t ( is, of)2 235( It)1 116( which use the same rules as macro delimiters.)8 1895(value executes all statements inside the delimiter characters,)7 2434 4 720 6913 t (course, useful for many tasks beyond plotting functions.)7 2245 1 720 7033 t (The)970 7189 w 10 CW f (if)1150 7189 w 10 R f ( a \256le contains data on both cities)7 1342( If)1 116(statement provides a simple mechanism for conditional execution.)7 2647 3 1295 7189 t (and states \(and lines describing states have ``S'' in the \256rst \256eld\), it could be plotted by statements like)18 4110 1 720 7309 t cleartomark showpage saveobj restore %%EndPage: 11 13 %%Page: 12 14 /saveobj save def mark 14 pagesetup 10 R f (- 12 -)2 216 1 2952 480 t 9 CW f (if "$1" == "S" then {)5 1134 1 1080 890 t (PlotState\($2,$3,$4\))1512 1000 w (} else {)2 432 1 1080 1110 t (PlotCity\($2,$3,$4,$5,$6\))1512 1220 w (})1080 1330 w 10 R f (The)720 1510 w 10 CW f (else)900 1510 w 10 R f (clause is optional; delimiters use the same rules as macros and)10 2491 1 1165 1510 t 10 CW f (for)3681 1510 w 10 R f (statements.)3886 1510 w 10 B f ( Collection of Examples)3 1008(3. A)1 197 2 720 1750 t 10 R f (The previous section covered the)4 1323 1 970 1906 t 10 I f (grap)2319 1906 w 10 R f ( this section we'll spend)4 970( In)1 134(commands that are used in common graphs.)6 1762 3 2534 1906 t ( are intended more for brows-)5 1203( examples)1 406( These)1 292(less time on language features, and survey a wider variety of graphs.)11 2779 4 720 2026 t ( Section 5 when you stum-)5 1084( prepared to refer to the manual in)7 1374( Be)1 163(ing and reference than for straight-through reading.)6 2059 4 720 2146 t (ble over a new)3 584 1 720 2266 t 10 I f (grap)1329 2266 w 10 R f (feature.)1543 2266 w (The \256le)1 314 1 970 2422 t 10 CW f (cars.d)1315 2422 w 10 R f (contains the mileage \(miles per gallon\) and the weight \(pounds\) for 74 models of automo-)14 3693 1 1707 2422 t (biles sold in the United States in the 1979 model year.)10 2163 1 720 2542 t 9 CW f (22 2930)1 432 1 1134 2712 t (17 3350)1 432 1 1134 2822 t (22 2640)1 432 1 1134 2932 t (17 2830)1 432 1 1134 3042 t (23 2070)1 432 1 1134 3152 t (...)1080 3262 w (17 3170)1 432 1 1134 3372 t 10 R f (The trivial)1 419 1 720 3552 t 10 I f (grap)1164 3552 w 10 R f (program)1378 3552 w 9 CW f (copy "cars.d")1 702 1 1080 3722 t 10 R f (produces)720 3902 w 2129 4064 2129 5504 Dl 4289 4064 2129 4064 Dl 4289 5504 4289 4064 Dl 2129 5504 4289 5504 Dl 2131 5576 2131 5504 Dl (10)2081 5686 w 2785 5576 2785 5504 Dl (20)2735 5686 w 3438 5576 3438 5504 Dl (30)3388 5686 w 4091 5576 4091 5504 Dl (40)4041 5686 w 2057 5316 2129 5316 Dl (2000)1832 5336 w 2057 4907 2129 4907 Dl (3000)1832 4927 w 2057 4496 2129 4496 Dl (4000)1832 4516 w 2057 4087 2129 4087 Dl (5000)1832 4107 w 10 S f (\267)2893 4955 w (\267)2566 4783 w (\267)2893 5074 w (\267)2566 4996 w (\267)2957 5308 w (\267)3088 5070 w (\267)2762 4824 w (\267)2435 4484 w (\267)2631 4652 w (\267)3154 5242 w (\267)2762 4811 w (\267)2500 4566 w (\267)2696 4762 w (\267)2370 4381 w (\267)2370 4557 w (\267)2827 4397 w (\267)3350 5292 w (\267)2500 4644 w (\267)2893 4852 w (\267)2893 4837 w (\267)3023 5029 w (\267)2696 4750 w (\267)2957 5185 w (\267)3741 5328 w (\267)3023 5222 w (\267)2827 5029 w (\267)3415 5287 w (\267)2631 4680 w (\267)2500 4570 w (\267)2566 4623 w (\267)2827 5283 w (\267)3284 5418 w (\267)2827 5070 w (\267)3088 5238 w (\267)3284 5435 w (\267)2239 4172 w (\267)2239 4221 w (\267)2370 4586 w (\267)3415 5345 w (\267)2893 5099 w (\267)2370 4492 w (\267)2370 4463 w (\267)2435 4631 w (\267)2631 4775 w (\267)2762 4996 w (\267)2827 4492 w (\267)2696 4804 w (\267)2696 4799 w (\267)2631 4644 w (\267)2696 4775 w (\267)3023 5041 w (\267)2500 4504 w (\267)2370 4755 w (\267)3284 5189 w (\267)3677 5418 w (\267)3088 5255 w (\267)3154 5123 w (\267)2631 4791 w (\267)2631 4639 w (\267)2631 4734 w (\267)2696 4840 w (\267)2696 4845 w (\267)2696 4755 w (\267)3023 5053 w (\267)3154 5406 w (\267)3741 5316 w (\267)2631 5169 w (\267)3480 5255 w (\267)2631 5062 w (\267)3088 5365 w (\267)4134 5320 w (\267)3088 5341 w (\267)2957 5271 w (\267)2566 4857 w 10 R f ( worse mileage; it)3 725(This graph shows that weights bottom out somewhat below 2000 pounds and that heavier cars get)15 3955 2 720 5954 t (is hard to say much more about the relationship between weight and mileage.)12 3087 1 720 6074 t ( of bullets, and re-expresses the)5 1263(The next graph provides labels, uses circles to expose data hidden in the clouds)13 3167 2 970 6230 t 10 I f (x)720 6350 w 10 R f ( the point size and vertical spacing to a size appropriate for camera-ready)12 2967( also changes)2 542( It)1 116(-axis in gallons per mile.)4 1011 4 764 6350 t ( made outside the)3 714(journal articles and books; the size changes should be)8 2165 2 720 6470 t 10 I f (grap)3628 6470 w 10 R f (program. The)1 572 1 3846 6470 t 10 CW f (.ft)4447 6470 w 10 R f (command changes)1 744 1 4656 6470 t (to a Helvetica font, which some people prefer for graphs.)9 2280 1 720 6590 t cleartomark showpage saveobj restore %%EndPage: 12 14 %%Page: 13 15 /saveobj save def mark 15 pagesetup 10 R f (- 13 -)2 216 1 2952 480 t 9 CW f (.ft H)1 270 1 1080 890 t (.ps -2)1 324 1 1080 1000 t (.vs -2)1 324 1 1080 1110 t (frame ht 2.5 wid 2.5)4 1080 1 1080 1220 t (label left "Weight" "\(Pounds\)" left .3)5 2052 1 1080 1330 t (label bot "Gallons per Mile")4 1512 1 1080 1440 t (coord x 0,.10 y 0,5000)4 1188 1 1080 1550 t (ticks left from 0 to 5000 by 1000)7 1782 1 1080 1660 t (ticks bot from 0 to .10 by .02)7 1620 1 1080 1770 t (copy "cars.d" thru { circle at 1/$1, $2 })8 2214 1 1080 1880 t (.vs +2)1 324 1 1080 1990 t (.ps +2)1 324 1 1080 2100 t (.ft)1080 2210 w 10 I f (Grap)720 2390 w 10 R f (supports logarithmic re-expression of data with the)6 2180 1 980 2390 t 10 CW f (log)3209 2390 w 10 R f (clause in the)2 547 1 3438 2390 t 10 CW f (coord)4034 2390 w 10 R f (statement; any other re-)3 1017 1 4383 2390 t (expression of data must be done with)6 1487 1 720 2510 t 10 I f (grap)2232 2510 w 10 R f (arithmetic, as above.)2 826 1 2446 2510 t 8 H f 2531 2704 2531 4504 Dl 4331 2704 2531 2704 Dl 4331 4504 4331 2704 Dl 2531 4504 4331 4504 Dl (Weight)1855 3570 w (\(Pounds\))1817 3670 w (Gallons per Mile)2 580 1 3141 4821 t 2459 4504 2531 4504 Dl (0)2392 4520 w 2459 4144 2531 4144 Dl (1000)2257 4160 w 2459 3784 2531 3784 Dl (2000)2257 3800 w 2459 3424 2531 3424 Dl (3000)2257 3440 w 2459 3064 2531 3064 Dl (4000)2257 3080 w 2459 2704 2531 2704 Dl (5000)2257 2720 w 2531 4576 2531 4504 Dl (0)2509 4682 w 2891 4576 2891 4504 Dl (0.02)2813 4682 w 3251 4576 3251 4504 Dl (0.04)3173 4682 w 3611 4576 3611 4504 Dl (0.06)3533 4682 w 3971 4576 3971 4504 Dl (0.08)3893 4682 w 4331 4576 4331 4504 Dl (0.1)4275 4682 w 5 S1 f ()3341 3465 w 3341 3465 m 19 build_ob 3360 3465 m ()3581 3314 w 3581 3314 m 19 build_ob 3600 3314 m ()3341 3570 w 3341 3570 m 19 build_ob 3360 3570 m ()3581 3501 w 3581 3501 m 19 build_ob 3600 3501 m ()3305 3775 w 3305 3775 m 19 build_ob 3324 3775 m ()3242 3566 w 3242 3566 m 19 build_ob 3261 3566 m ()3422 3350 w 3422 3350 m 19 build_ob 3441 3350 m ()3723 3051 w 3723 3051 m 19 build_ob 3742 3051 m ()3522 3199 w 3522 3199 m 19 build_ob 3541 3199 m ()3215 3717 w 3215 3717 m 19 build_ob 3234 3717 m ()3422 3339 w 3422 3339 m 19 build_ob 3441 3339 m ()3648 3123 w 3648 3123 m 19 build_ob 3667 3123 m ()3470 3296 w 3470 3296 m 19 build_ob 3489 3296 m ()3808 2961 w 3808 2961 m 19 build_ob 3827 2961 m ()3808 3116 w 3808 3116 m 19 build_ob 3827 3116 m ()3380 2976 w 3380 2976 m 19 build_ob 3399 2976 m ()3143 3761 w 3143 3761 m 19 build_ob 3162 3761 m ()3648 3192 w 3648 3192 m 19 build_ob 3667 3192 m ()3341 3375 w 3341 3375 m 19 build_ob 3360 3375 m ()3341 3361 w 3341 3361 m 19 build_ob 3360 3361 m ()3273 3530 w 3273 3530 m 19 build_ob 3292 3530 m ()3470 3285 w 3470 3285 m 19 build_ob 3489 3285 m ()3305 3667 w 3305 3667 m 19 build_ob 3324 3667 m ()3037 3793 w 3037 3793 m 19 build_ob 3056 3793 m ()3273 3699 w 3273 3699 m 19 build_ob 3292 3699 m ()3380 3530 w 3380 3530 m 19 build_ob 3399 3530 m ()3123 3757 w 3123 3757 m 19 build_ob 3142 3757 m ()3522 3224 w 3522 3224 m 19 build_ob 3541 3224 m ()3648 3127 w 3648 3127 m 19 build_ob 3667 3127 m ()3581 3174 w 3581 3174 m 19 build_ob 3600 3174 m ()3380 3753 w 3380 3753 m 19 build_ob 3399 3753 m ()3165 3872 w 3165 3872 m 19 build_ob 3184 3872 m ()3380 3566 w 3380 3566 m 19 build_ob 3399 3566 m ()3242 3714 w 3242 3714 m 19 build_ob 3261 3714 m ()3165 3887 w 3165 3887 m 19 build_ob 3184 3887 m ()4023 2778 w 4023 2778 m 19 build_ob 4042 2778 m ()4023 2821 w 4023 2821 m 19 build_ob 4042 2821 m ()3808 3141 w 3808 3141 m 19 build_ob 3827 3141 m ()3123 3807 w 3123 3807 m 19 build_ob 3142 3807 m ()3341 3591 w 3341 3591 m 19 build_ob 3360 3591 m ()3808 3059 w 3808 3059 m 19 build_ob 3827 3059 m ()3808 3033 w 3808 3033 m 19 build_ob 3827 3033 m ()3723 3181 w 3723 3181 m 19 build_ob 3742 3181 m ()3522 3307 w 3522 3307 m 19 build_ob 3541 3307 m ()3422 3501 w 3422 3501 m 19 build_ob 3441 3501 m ()3380 3059 w 3380 3059 m 19 build_ob 3399 3059 m ()3470 3332 w 3470 3332 m 19 build_ob 3489 3332 m ()3470 3329 w 3470 3329 m 19 build_ob 3489 3329 m ()3522 3192 w 3522 3192 m 19 build_ob 3541 3192 m ()3470 3307 w 3470 3307 m 19 build_ob 3489 3307 m ()3273 3541 w 3273 3541 m 19 build_ob 3292 3541 m ()3648 3069 w 3648 3069 m 19 build_ob 3667 3069 m ()3808 3289 w 3808 3289 m 19 build_ob 3827 3289 m ()3165 3671 w 3165 3671 m 19 build_ob 3184 3671 m ()3052 3872 w 3052 3872 m 19 build_ob 3071 3872 m ()3242 3728 w 3242 3728 m 19 build_ob 3261 3728 m ()3215 3613 w 3215 3613 m 19 build_ob 3234 3613 m ()3522 3321 w 3522 3321 m 19 build_ob 3541 3321 m ()3522 3188 w 3522 3188 m 19 build_ob 3541 3188 m ()3522 3271 w 3522 3271 m 19 build_ob 3541 3271 m ()3470 3365 w 3470 3365 m 19 build_ob 3489 3365 m ()3470 3368 w 3470 3368 m 19 build_ob 3489 3368 m ()3470 3289 w 3470 3289 m 19 build_ob 3489 3289 m ()3273 3552 w 3273 3552 m 19 build_ob 3292 3552 m ()3215 3861 w 3215 3861 m 19 build_ob 3234 3861 m ()3037 3782 w 3037 3782 m 19 build_ob 3056 3782 m ()3522 3653 w 3522 3653 m 19 build_ob 3541 3653 m ()3103 3728 w 3103 3728 m 19 build_ob 3122 3728 m ()3522 3559 w 3522 3559 m 19 build_ob 3541 3559 m ()3242 3825 w 3242 3825 m 19 build_ob 3261 3825 m ()2961 3786 w 2961 3786 m 19 build_ob 2980 3786 m ()3242 3804 w 3242 3804 m 19 build_ob 3261 3804 m ()3305 3743 w 3305 3743 m 19 build_ob 3324 3743 m ()3581 3379 w 3581 3379 m 19 build_ob 3600 3379 m 10 R f ( two outliers near 4000 pounds are)6 1429( \(The)1 246( per mile is roughly proportional to weight.)7 1783(This graph shows that gallons)4 1222 4 720 5049 t (the Cadillac Seville and the Oldsmobile 98.\))6 1774 1 720 5169 t (In)970 5325 w 10 I f (Visual Display of Quantitative Information)4 1727 1 1079 5325 t 10 R f ( maximizing)1 505(, Tufte proposes the ``dot-dash-plot'' as a means for)8 2089 2 2806 5325 t ( distributions\) while mini-)3 1051(data ink \(showing the two-dimensional distribution and the two one-dimensional marginal)10 3629 2 720 5445 t ( preference is easy to express)5 1190( His)1 194( wasted on borders and non-data labels.)6 1607(mizing what he calls ``chart junk'' \320 ink)7 1689 4 720 5565 t (in)720 5685 w 10 I f (grap)823 5685 w 10 R f (:)1012 5685 w 9 CW f (frame invis ht 3 wid 3)5 1188 1 1080 5855 t (coord x 0, .10 y 0, 5000)6 1296 1 1080 5965 t (copy "cars.d" thru {)3 1080 1 1080 6075 t (tx = 1/$1; ty = $2)5 972 1 1512 6185 t (bullet at tx,ty)2 810 1 1512 6295 t (tick bot at tx "")4 918 1 1512 6405 t (tick left at ty "")4 972 1 1512 6515 t (})1080 6625 w 10 R f (Although visually attractive, we do not \256nd the resulting graph as useful for interpreting the data.)15 3887 1 720 6805 t cleartomark showpage saveobj restore %%EndPage: 13 15 %%Page: 14 16 /saveobj save def mark 16 pagesetup 10 R f (- 14 -)2 216 1 2952 480 t 10 S f (\267)2993 1763 w 3016 3072 3016 3000 Dl 1962 1734 2034 1734 Dl (\267)3281 1581 w 3304 3072 3304 3000 Dl 1962 1552 2034 1552 Dl (\267)2993 1888 w 3016 3072 3016 3000 Dl 1962 1859 2034 1859 Dl (\267)3281 1806 w 3304 3072 3304 3000 Dl 1962 1777 2034 1777 Dl (\267)2949 2134 w 2972 3072 2972 3000 Dl 1962 2105 2034 2105 Dl (\267)2875 1884 w 2898 3072 2898 3000 Dl 1962 1855 2034 1855 Dl (\267)3091 1625 w 3114 3072 3114 3000 Dl 1962 1596 2034 1596 Dl (\267)3451 1266 w 3474 3072 3474 3000 Dl 1962 1237 2034 1237 Dl (\267)3211 1443 w 3234 3072 3234 3000 Dl 1962 1414 2034 1414 Dl (\267)2841 2065 w 2864 3072 2864 3000 Dl 1962 2036 2034 2036 Dl (\267)3091 1612 w 3114 3072 3114 3000 Dl 1962 1583 2034 1583 Dl (\267)3361 1352 w 3384 3072 3384 3000 Dl 1962 1323 2034 1323 Dl (\267)3147 1560 w 3170 3072 3170 3000 Dl 1962 1531 2034 1531 Dl (\267)3553 1158 w 3576 3072 3576 3000 Dl 1962 1129 2034 1129 Dl (\267)3553 1344 w 3576 3072 3576 3000 Dl 1962 1315 2034 1315 Dl (\267)3039 1175 w 3062 3072 3062 3000 Dl 1962 1146 2034 1146 Dl (\267)2755 2117 w 2778 3072 2778 3000 Dl 1962 2088 2034 2088 Dl (\267)3361 1434 w 3384 3072 3384 3000 Dl 1962 1405 2034 1405 Dl (\267)2993 1655 w 3016 3072 3016 3000 Dl 1962 1626 2034 1626 Dl (\267)2993 1637 w 3016 3072 3016 3000 Dl 1962 1608 2034 1608 Dl (\267)2911 1841 w 2934 3072 2934 3000 Dl 1962 1812 2034 1812 Dl (\267)3147 1547 w 3170 3072 3170 3000 Dl 1962 1518 2034 1518 Dl (\267)2949 2005 w 2972 3072 2972 3000 Dl 1962 1976 2034 1976 Dl (\267)2628 2156 w 2651 3072 2651 3000 Dl 1962 2127 2034 2127 Dl (\267)2911 2044 w 2934 3072 2934 3000 Dl 1962 2015 2034 2015 Dl (\267)3039 1841 w 3062 3072 3062 3000 Dl 1962 1812 2034 1812 Dl (\267)2731 2113 w 2754 3072 2754 3000 Dl 1962 2084 2034 2084 Dl (\267)3211 1473 w 3234 3072 3234 3000 Dl 1962 1444 2034 1444 Dl (\267)3361 1357 w 3384 3072 3384 3000 Dl 1962 1328 2034 1328 Dl (\267)3281 1413 w 3304 3072 3304 3000 Dl 1962 1384 2034 1384 Dl (\267)3039 2108 w 3062 3072 3062 3000 Dl 1962 2079 2034 2079 Dl (\267)2782 2251 w 2805 3072 2805 3000 Dl 1962 2222 2034 2222 Dl (\267)3039 1884 w 3062 3072 3062 3000 Dl 1962 1855 2034 1855 Dl (\267)2875 2061 w 2898 3072 2898 3000 Dl 1962 2032 2034 2032 Dl (\267)2782 2268 w 2805 3072 2805 3000 Dl 1962 2239 2034 2239 Dl (\267)3811 938 w 3834 3072 3834 3000 Dl 1962 909 2034 909 Dl (\267)3811 989 w 3834 3072 3834 3000 Dl 1962 960 2034 960 Dl (\267)3553 1374 w 3576 3072 3576 3000 Dl 1962 1345 2034 1345 Dl (\267)2731 2173 w 2754 3072 2754 3000 Dl 1962 2144 2034 2144 Dl (\267)2993 1914 w 3016 3072 3016 3000 Dl 1962 1885 2034 1885 Dl (\267)3553 1275 w 3576 3072 3576 3000 Dl 1962 1246 2034 1246 Dl (\267)3553 1244 w 3576 3072 3576 3000 Dl 1962 1215 2034 1215 Dl (\267)3451 1421 w 3474 3072 3474 3000 Dl 1962 1392 2034 1392 Dl (\267)3211 1573 w 3234 3072 3234 3000 Dl 1962 1544 2034 1544 Dl (\267)3091 1806 w 3114 3072 3114 3000 Dl 1962 1777 2034 1777 Dl (\267)3039 1275 w 3062 3072 3062 3000 Dl 1962 1246 2034 1246 Dl (\267)3147 1603 w 3170 3072 3170 3000 Dl 1962 1574 2034 1574 Dl (\267)3147 1599 w 3170 3072 3170 3000 Dl 1962 1570 2034 1570 Dl (\267)3211 1434 w 3234 3072 3234 3000 Dl 1962 1405 2034 1405 Dl (\267)3147 1573 w 3170 3072 3170 3000 Dl 1962 1544 2034 1544 Dl (\267)2911 1853 w 2934 3072 2934 3000 Dl 1962 1824 2034 1824 Dl (\267)3361 1288 w 3384 3072 3384 3000 Dl 1962 1259 2034 1259 Dl (\267)3553 1551 w 3576 3072 3576 3000 Dl 1962 1522 2034 1522 Dl (\267)2782 2009 w 2805 3072 2805 3000 Dl 1962 1980 2034 1980 Dl (\267)2646 2251 w 2669 3072 2669 3000 Dl 1962 2222 2034 2222 Dl (\267)2875 2078 w 2898 3072 2898 3000 Dl 1962 2049 2034 2049 Dl (\267)2841 1940 w 2864 3072 2864 3000 Dl 1962 1911 2034 1911 Dl (\267)3211 1590 w 3234 3072 3234 3000 Dl 1962 1561 2034 1561 Dl (\267)3211 1430 w 3234 3072 3234 3000 Dl 1962 1401 2034 1401 Dl (\267)3211 1529 w 3234 3072 3234 3000 Dl 1962 1500 2034 1500 Dl (\267)3147 1642 w 3170 3072 3170 3000 Dl 1962 1613 2034 1613 Dl (\267)3147 1646 w 3170 3072 3170 3000 Dl 1962 1617 2034 1617 Dl (\267)3147 1551 w 3170 3072 3170 3000 Dl 1962 1522 2034 1522 Dl (\267)2911 1866 w 2934 3072 2934 3000 Dl 1962 1837 2034 1837 Dl (\267)2841 2238 w 2864 3072 2864 3000 Dl 1962 2209 2034 2209 Dl (\267)2628 2143 w 2651 3072 2651 3000 Dl 1962 2114 2034 2114 Dl (\267)3211 1987 w 3234 3072 3234 3000 Dl 1962 1958 2034 1958 Dl (\267)2707 2078 w 2730 3072 2730 3000 Dl 1962 2049 2034 2049 Dl (\267)3211 1875 w 3234 3072 3234 3000 Dl 1962 1846 2034 1846 Dl (\267)2875 2195 w 2898 3072 2898 3000 Dl 1962 2166 2034 2166 Dl (\267)2538 2147 w 2561 3072 2561 3000 Dl 1962 2118 2034 2118 Dl (\267)2875 2169 w 2898 3072 2898 3000 Dl 1962 2140 2034 2140 Dl (\267)2949 2095 w 2972 3072 2972 3000 Dl 1962 2066 2034 2066 Dl (\267)3281 1659 w 3304 3072 3304 3000 Dl 1962 1630 2034 1630 Dl 10 R f ( gap in car weights near)5 970(Tufte's graph does point out two facts that are not obvious in the previous graphs: there is a)17 3710 2 720 3450 t (3000 pounds \(exhibited by the hole in the)7 1670 1 720 3570 t 10 I f (y)2416 3570 w 10 R f ( regularly structured \(the ticks)4 1203(-axis ticks\), and the gallons per mile axis is)8 1737 2 2460 3570 t ( insights are)2 515( reader may decide whether those)5 1412( The)1 220(are the reciprocals of an almost dense sequence of integers\).)9 2533 4 720 3690 t (worth the decrease in clarity.)4 1155 1 720 3810 t (Throughout the twentieth century, horses, cars and people have gotten faster; let's study those improvements.)14 4430 1 970 3966 t ( 1909 to 1988, in the \256le)6 1245(For horses, we'll consider the winning times of the Kentucky Derby from)11 3435 2 720 4086 t 10 CW f (speedhorse.d)720 4206 w 10 R f (:)1440 4206 w 9 CW f (126.2)1080 4376 w (126.4)1080 4486 w (125.0)1080 4596 w (129.4)1080 4706 w (124.8)1080 4816 w (...)1080 4926 w (122.2)1080 5036 w 10 R f (The program)1 518 1 720 5216 t 9 CW f (label left "Winning Time" "\(seconds\)" left .3)6 2430 1 1080 5386 t (label bot "Kentucky Derby, 1909 to 1988")6 2160 1 1080 5496 t ( Greater than first time)4 1296( #)1 162(bestsofar = 1000)2 864 3 1080 5606 t (year = 09)2 486 1 1080 5716 t (copy "speedhorse.d" thru {)3 1404 1 1080 5826 t (bullet at year, $1)3 972 1 1512 5936 t (bestsofar = min\(bestsofar, $1\))3 1620 1 1512 6046 t (line from year, bestsofar to year+1, bestsofar)6 2484 1 1512 6156 t (year = year+1)2 702 1 1512 6266 t (})1080 6376 w 10 R f (produces the graph)2 759 1 720 6556 t cleartomark showpage saveobj restore %%EndPage: 14 16 %%Page: 15 17 /saveobj save def mark 17 pagesetup 10 R f (- 15 -)2 216 1 2952 480 t 2448 840 2448 2280 Dl 4608 840 2448 840 Dl 4608 2280 4608 840 Dl 2448 2280 4608 2280 Dl 2841 2352 2841 2280 Dl (20)2791 2462 w 3314 2352 3314 2280 Dl (40)3264 2462 w 3788 2352 3788 2280 Dl (60)3738 2462 w 4262 2352 4262 2280 Dl (80)4212 2462 w 2376 2125 2448 2125 Dl (120)2201 2145 w 2376 1570 2448 1570 Dl (125)2201 1590 w 2376 1017 2448 1017 Dl (130)2201 1037 w (Winning Time)1 586 1 1507 1520 t (\(seconds\))1609 1640 w (Kentucky Derby, 1909 to 1988)4 1240 1 2908 2600 t 10 S f (\267)2557 1467 w 2603 1438 2580 1438 Dl (\267)2581 1445 w 2627 1438 2604 1438 Dl (\267)2605 1599 w 2651 1570 2628 1570 Dl (\267)2628 1112 w 2674 1570 2651 1570 Dl (\267)2652 1622 w 2698 1593 2675 1593 Dl (\267)2676 1777 w 2722 1748 2699 1748 Dl (\267)2700 1555 w 2746 1748 2723 1748 Dl (\267)2723 1644 w 2769 1748 2746 1748 Dl (\267)2746 1710 w 2792 1748 2769 1748 Dl (\267)2770 957 w 2816 1748 2793 1748 Dl (\267)2794 1068 w 2840 1748 2817 1748 Dl (\267)2818 1157 w 2864 1748 2841 1748 Dl (\267)2841 1689 w 2887 1748 2864 1748 Dl (\267)2865 1644 w 2911 1748 2888 1748 Dl (\267)2889 1555 w 2935 1748 2912 1748 Dl (\267)2913 1555 w 2959 1748 2936 1748 Dl (\267)2936 1311 w 2982 1748 2959 1748 Dl (\267)2959 1733 w 3005 1748 2982 1748 Dl (\267)2983 1488 w 3029 1748 3006 1748 Dl (\267)3007 1001 w 3053 1748 3030 1748 Dl (\267)3031 957 w 3077 1748 3054 1748 Dl (\267)3055 1311 w 3101 1748 3078 1748 Dl (\267)3078 1954 w 3124 1925 3101 1925 Dl (\267)3102 1578 w 3148 1925 3125 1925 Dl (\267)3126 1400 w 3172 1925 3149 1925 Dl (\267)3150 1710 w 3196 1925 3173 1925 Dl (\267)3173 1599 w 3219 1925 3196 1925 Dl (\267)3196 1755 w 3242 1925 3219 1925 Dl (\267)3220 1799 w 3266 1925 3243 1925 Dl (\267)3244 1622 w 3290 1925 3267 1925 Dl (\267)3268 1777 w 3314 1925 3291 1925 Dl (\267)3291 1599 w 3337 1925 3314 1925 Dl (\267)3315 1998 w 3361 1969 3338 1969 Dl (\267)3339 1666 w 3385 1969 3362 1969 Dl (\267)3363 1710 w 3409 1969 3386 1969 Dl (\267)3386 1689 w 3432 1969 3409 1969 Dl (\267)3409 1378 w 3455 1969 3432 1969 Dl (\267)3433 1422 w 3479 1969 3456 1969 Dl (\267)3457 1422 w 3503 1969 3480 1969 Dl (\267)3481 1555 w 3527 1969 3504 1969 Dl (\267)3505 1689 w 3551 1969 3528 1969 Dl (\267)3528 1977 w 3574 1969 3551 1969 Dl (\267)3552 1866 w 3598 1969 3575 1969 Dl (\267)3576 1977 w 3622 1969 3599 1969 Dl (\267)3600 1932 w 3646 1969 3623 1969 Dl (\267)3623 1821 w 3669 1969 3646 1969 Dl (\267)3646 1954 w 3692 1969 3669 1969 Dl (\267)3670 1777 w 3716 1969 3693 1969 Dl (\267)3694 1910 w 3740 1969 3717 1969 Dl (\267)3718 1599 w 3764 1969 3741 1969 Dl (\267)3741 1910 w 3787 1969 3764 1969 Dl (\267)3765 1888 w 3811 1969 3788 1969 Dl (\267)3789 1710 w 3835 1969 3812 1969 Dl (\267)3813 2109 w 3859 2080 3836 2080 Dl (\267)3836 1954 w 3882 2080 3859 2080 Dl (\267)3859 2154 w 3905 2125 3882 2125 Dl (\267)3883 2021 w 3929 2125 3906 2125 Dl (\267)3907 1932 w 3953 2125 3930 2125 Dl (\267)3931 2087 w 3977 2125 3954 2125 Dl (\267)3955 1910 w 4001 2125 3978 2125 Dl (\267)3978 1954 w 4024 2125 4001 2125 Dl (\267)4002 1777 w 4048 2125 4025 2125 Dl (\267)4026 1799 w 4072 2125 4049 2125 Dl (\267)4050 1954 w 4096 2125 4073 2125 Dl (\267)4073 2220 w 4119 2191 4096 2191 Dl (\267)4096 1710 w 4142 2191 4119 2191 Dl (\267)4120 1932 w 4166 2191 4143 2191 Dl (\267)4144 1977 w 4190 2191 4167 2191 Dl (\267)4168 1910 w 4214 2191 4191 2191 Dl (\267)4191 2021 w 4237 2191 4214 2191 Dl (\267)4215 1888 w 4261 2191 4238 2191 Dl (\267)4239 1932 w 4285 2191 4262 2191 Dl (\267)4263 1932 w 4309 2191 4286 2191 Dl (\267)4286 1888 w 4332 2191 4309 2191 Dl (\267)4309 1910 w 4355 2191 4332 2191 Dl (\267)4333 1888 w 4379 2191 4356 2191 Dl (\267)4357 2131 w 4403 2191 4380 2191 Dl (\267)4381 1843 w 4427 2191 4404 2191 Dl (\267)4405 1777 w 4451 2191 4428 2191 Dl (\267)4428 1910 w 4474 2191 4451 2191 Dl 10 R f ( is the only horse to)5 811( Secretariat)1 480(Each race is recorded with a bullet and record times are marked by horizontal lines.)14 3389 3 720 2838 t (have run the one-and-a-quarter-mile race in under two minutes; he won in 1973 in 1:59.4.)14 3582 1 720 2958 t ( those vehicles are by now just low-)7 1476(For automobiles we will study the world land speed record \(even though)11 2954 2 970 3114 t ( \256le)1 157( The)1 209(\257ying airplanes\).)1 681 3 720 3234 t 10 CW f (speedcar.d)1796 3234 w 10 R f ( set in that year,)4 647(lists years in which speed records were set and the record)10 2328 2 2425 3234 t (in miles per hour averaged over a one-mile course.)8 2025 1 720 3354 t 9 CW f (06 127)1 594 1 1080 3524 t (10 131)1 594 1 1080 3634 t (11 141)1 594 1 1080 3744 t (19 149)1 594 1 1080 3854 t (20 155)1 594 1 1080 3964 t (...)1080 4074 w (83 633)1 594 1 1080 4184 t 10 R f (We will plot the data with the following)7 1602 1 720 4364 t 10 I f (grap)2347 4364 w 10 R f (program, which uses nested braces in the)6 1638 1 2561 4364 t 10 CW f (copy)4224 4364 w 10 R f (and)4489 4364 w 10 CW f (if)4658 4364 w 10 R f (statements.)4803 4364 w 9 CW f (label bot "World Land Speed Record")5 1890 1 1080 4534 t (label left "Miles" "per" "Hour" left .4)6 2106 1 1080 4644 t (ticks bot out from 10 to 70 by 10 "")9 1944 1 1080 4754 t (ticks bot out at 0 "1900", 40 "1940", 80 "1980")9 2538 1 1080 4864 t (firstrecord = 1)2 810 1 1080 4974 t (copy "speedcar.d" thru {)3 1296 1 1080 5084 t (if firstrecord == 1 then {)5 1404 1 1512 5194 t (firstrecord = 0)2 810 1 1944 5304 t (} else {)2 432 1 1512 5414 t (line from lastyear, lastrec to $1, lastrec)6 2268 1 1944 5524 t (})1512 5634 w (lastyear = $1; lastrec = $2)5 1458 1 1512 5744 t (})1080 5854 w (line from lastyear, lastrec to 84, lastrec)6 2268 1 1080 5964 t 10 R f ( after the)2 366(Each record line is drawn)4 1039 2 970 6180 t 10 I f (next)2406 6180 w 10 R f (record is read, because the program must know when the record was)11 2797 1 2603 6180 t ( The)1 214(broken to draw its line.)4 960 2 720 6300 t 10 CW f (if)1928 6300 w 10 R f (statement handles the \256rst record, and the extra)7 1948 1 2082 6300 t 10 CW f (line)4064 6300 w 10 R f (command extends the last)3 1062 1 4338 6300 t (record out to the current date.)5 1180 1 720 6420 t cleartomark showpage saveobj restore %%EndPage: 15 17 %%Page: 16 18 /saveobj save def mark 18 pagesetup 10 R f (- 16 -)2 216 1 2952 480 t 2315 840 2315 2280 Dl 4475 840 2315 840 Dl 4475 2280 4475 840 Dl 2315 2280 4475 2280 Dl 2243 2259 2315 2259 Dl (100)2068 2279 w 2243 2009 2315 2009 Dl (200)2068 2029 w 2243 1759 2315 1759 Dl (300)2068 1779 w 2243 1510 2315 1510 Dl (400)2068 1530 w 2243 1260 2315 1260 Dl (500)2068 1280 w 2243 1010 2315 1010 Dl (600)2068 1030 w (World Land Speed Record)3 1067 1 2862 2600 t (Miles)1650 1460 w (per)1701 1580 w (Hour)1662 1700 w 2674 2352 2674 2280 Dl 2899 2352 2899 2280 Dl 3125 2352 3125 2280 Dl 3351 2352 3351 2280 Dl 3576 2352 3576 2280 Dl 3801 2352 3801 2280 Dl 4027 2352 4027 2280 Dl 2448 2352 2448 2280 Dl (1900)2348 2462 w 3351 2352 3351 2280 Dl (1940)3251 2462 w 4253 2352 4253 2280 Dl (1980)4153 2462 w 2674 2191 2584 2191 Dl 2696 2181 2674 2181 Dl 2876 2156 2696 2156 Dl 2899 2136 2877 2136 Dl 3034 2121 2899 2121 Dl 3057 2084 3035 2084 Dl 3079 2002 3057 2002 Dl 3102 1992 3080 1992 Dl 3147 1932 3102 1932 Dl 3170 1894 3148 1894 Dl 3192 1876 3170 1876 Dl 3237 1829 3192 1829 Dl 3283 1757 3238 1757 Dl 3305 1732 3283 1732 Dl 3327 1617 3305 1617 Dl 3508 1590 3328 1590 Dl 3868 1524 3508 1524 Dl 3891 1492 3869 1492 Dl 3914 1170 3892 1170 Dl 4027 1010 3914 1010 Dl 4320 955 4027 955 Dl 4342 928 4320 928 Dl ( records could also have)4 980( The)1 209( they are broken.)3 682(The horizontal lines re\257ect the nature of world records: they last until)11 2809 4 720 2838 t (been plotted by a scatterplot in which each point represents the setting of a record, but it would be misleading to)20 4680 1 720 2958 t ( Olympic 400 meter)3 829(connect adjacent points with line segments \(which we inappropriately did in the graphs of the)14 3851 2 720 3078 t (run\).)720 3198 w ( the world record times for the one mile run; because its)11 2243(The following graph shows)3 1096 2 970 3354 t 10 I f (grap)4335 3354 w 10 R f (program is so similar)3 850 1 4550 3354 t (to its automotive counterpart, we won't show the program or data.)10 2646 1 720 3474 t 2412 3636 2412 5076 Dl 4572 3636 2412 3636 Dl 4572 5076 4572 3636 Dl 2412 5076 4572 5076 Dl 2340 4827 2412 4827 Dl (230)2165 4847 w 2340 4393 2412 4393 Dl (240)2165 4413 w 2340 3959 2412 3959 Dl (250)2165 3979 w 2757 5148 2757 5076 Dl 2970 5148 2970 5076 Dl 3183 5148 3183 5076 Dl 3396 5148 3396 5076 Dl 3609 5148 3609 5076 Dl 3821 5148 3821 5076 Dl 4034 5148 4034 5076 Dl 2544 5148 2544 5076 Dl (1900)2444 5258 w 3396 5148 3396 5076 Dl (1940)3296 5258 w 4248 5148 4248 5076 Dl (1980)4148 5258 w (World Record One Mile Run)4 1165 1 2910 5396 t (Time)1659 4316 w (\(seconds\))1573 4436 w 2778 3724 1 1 De 2820 3724 2778 3724 Dl 2863 3759 2821 3759 Dl 3034 3846 2864 3846 Dl 3204 3941 3034 3941 Dl 3246 3993 3204 3993 Dl 3268 4062 3247 4062 Dl 3332 4098 3268 4098 Dl 3438 4115 3332 4115 Dl 3459 4193 3438 4193 Dl 3481 4280 3460 4280 Dl 3502 4323 3481 4323 Dl 3693 4332 3502 4332 Dl 3758 4480 3694 4480 Dl 3779 4515 3758 4515 Dl 3863 4632 3779 4632 Dl 3906 4636 3864 4636 Dl 3928 4649 3907 4649 Dl 3949 4671 3928 4671 Dl 3970 4771 3949 4771 Dl 4140 4780 3970 4780 Dl 4225 4853 4141 4853 Dl 4247 4870 4226 4870 Dl 4269 4880 4248 4880 Dl 4352 4943 4268 4943 Dl 4438 4987 4354 4987 Dl ( be)1 139( horses are getting faster, they appear to)7 1723( Although)1 447(The three graphs show three different kinds of changes.)8 2371 4 720 5634 t ( great jumps as new technologies are introduced followed by a)10 2565( show)1 244( Cars)1 241(approaching a barrier near two minutes.)5 1630 4 720 5754 t ( fairly consistent linear improvement over this)6 1878( have shown a)3 580( Milers)1 315(plateau as limits of the technology are reached.)7 1907 4 720 5874 t (century, but there must be an asymptote down there somewhere.)9 2570 1 720 5994 t ( with the \256fth and)4 747(The next \256le gives the median heights of boys in the United States aged 2 to 18, together)17 3683 2 970 6150 t (ninety-\256fth percentiles.)1 932 1 720 6270 t 9 CW f (2 82.5 86.8 94.4)3 1026 1 1134 6440 t ( 102.0)1 324(3 89.0 94.9)2 702 2 1134 6550 t ( 102.9 109.9)2 648(4 95.8)1 378 2 1134 6660 t (5 102.0 109.9 117.0)3 1026 1 1134 6770 t (6 107.7 116.1 123.5)3 1026 1 1134 6880 t (...)1080 6990 w (18 165.7 176.8 187.6)3 1080 1 1080 7100 t 10 R f ( trivial program)2 627( The)1 205(The heights are given in centimeters \(1 foot = 30.48 centimeters\).)10 2618 3 720 7280 t cleartomark showpage saveobj restore %%EndPage: 16 18 %%Page: 17 19 /saveobj save def mark 19 pagesetup 10 R f (- 17 -)2 216 1 2952 480 t 9 CW f (copy "boyhts.d")1 810 1 1080 890 t 10 R f (displays the data as)3 774 1 720 1070 t 2106 1232 2106 2672 Dl 4266 1232 2106 1232 Dl 4266 2672 4266 1232 Dl 2106 2672 4266 2672 Dl 2594 2744 2594 2672 Dl (5)2569 2854 w 3186 2744 3186 2672 Dl (10)3136 2854 w 3777 2744 3777 2672 Dl (15)3727 2854 w 2034 2373 2106 2373 Dl (100)1859 2393 w 2034 1772 2106 1772 Dl (150)1859 1792 w 10 S f (\267)2215 2603 w (\267)2215 2551 w (\267)2215 2460 w (\267)2334 2525 w (\267)2334 2454 w (\267)2334 2369 w (\267)2452 2443 w (\267)2452 2358 w (\267)2452 2274 w (\267)2571 2369 w (\267)2571 2274 w (\267)2571 2188 w (\267)2689 2301 w (\267)2689 2199 w (\267)2689 2110 w (\267)2808 2236 w (\267)2808 2132 w (\267)2808 2036 w (\267)2926 2175 w (\267)2926 2068 w (\267)2926 1964 w (\267)3044 2118 w (\267)3044 2006 w (\267)3044 1890 w (\267)3163 2060 w (\267)3163 1942 w (\267)3163 1815 w (\267)3281 2001 w (\267)3281 1872 w (\267)3281 1733 w (\267)3399 1941 w (\267)3399 1795 w (\267)3399 1644 w (\267)3517 1877 w (\267)3517 1714 w (\267)3517 1554 w (\267)3636 1806 w (\267)3636 1635 w (\267)3636 1471 w (\267)3754 1730 w (\267)3754 1563 w (\267)3754 1408 w (\267)3873 1658 w (\267)3873 1509 w (\267)3873 1367 w (\267)3991 1613 w (\267)3991 1477 w (\267)3991 1344 w (\267)4110 1603 w (\267)4110 1470 w (\267)4110 1340 w 10 R f ( as an)2 231(Because there are four numbers on each input line, the \256rst is taken)12 2698 2 720 3122 t 10 I f (x)3676 3122 w 10 R f (-value and the remaining three are plotted)6 1680 1 3720 3122 t (as)720 3242 w 10 I f (y)828 3242 w 10 R f (-values.)872 3242 w ( to be roughly straight \(at least up to age 16\), so it makes sense to \256t a line through)19 3455(The three curves appear)3 975 2 970 3398 t ( will use the standard least squares regression in which)9 2188(them. We)1 413 2 720 3518 t 10 I f (slope)2544 3738 w 10 S f (=)2804 3738 w 10 I f (n)2933 3818 w 10 S f (S)2991 3818 w 10 I f (x)3058 3818 w 7 R f (2)3113 3778 w 10 S f (-)3205 3818 w 10 R f (\()3309 3818 w 10 S f (S)3350 3818 w 10 I f (x)3417 3818 w 10 R f (\))3469 3818 w 7 R f (2)3507 3778 w 10 I f (n)2944 3678 w 10 S f (S)3002 3678 w 10 I f (xy)3069 3678 w 10 S f (- S)1 163 1 3206 3678 t 10 I f (x)3377 3678 w 10 S f (S)3429 3678 w 10 I f (y)3496 3678 w 10 S1 f (_ ____________)1 647 1 2919 3708 t 10 R f (\(where the summations range over all)5 1505 1 720 3978 t 10 I f (n x)1 119 1 2250 3978 t 10 R f (and)2394 3978 w 10 I f (y)2563 3978 w 10 R f (values in the data set\) and the)6 1181 1 2632 3978 t 10 I f (y)3838 3978 w 10 R f (-intercept is)1 474 1 3882 3978 t 10 I f (n)3034 4268 w 10 S f (S)2731 4138 w 10 I f (y)2798 4138 w 10 S f (-)2891 4138 w 10 I f (slope)2995 4138 w 10 S f (\264 S)1 122 1 3214 4138 t 10 I f (x)3344 4138 w 10 S1 f (_ _____________)1 687 1 2716 4168 t 10 R f (The following)1 569 1 720 4428 t 10 I f (grap)1314 4428 w 10 R f (program boldly \(and rather foolishly\) implements that formula.)7 2525 1 1528 4428 t 9 CW f (label left "Heights in Feet" "\(Median and" "fifth percentiles\)")8 3402 1 1080 4598 t (label bot "Heights of Boys in U.S., ages 2 to 18")10 2646 1 1080 4708 t ( Centimeters per foot)3 1134( #)1 162(cmpft = 30.48)2 702 3 1080 4818 t (minx = 1e12; maxx = -1e12)5 1350 1 1080 4928 t (n = sigx = sigx2 = sigy = sigxy = 0)10 1890 1 1080 5038 t (copy "boyhts.d" thru {)3 1188 1 1080 5148 t (line from $1, $2/cmpft to $1, $4/cmpft)6 2052 1 1512 5258 t (ty = $3/cmpft)2 702 1 1512 5368 t (bullet at $1,ty)2 810 1 1512 5478 t (n = n+1)2 378 1 1512 5588 t (sigx = sigx+$1; sigx2 = sigx2+$1*$1)5 1890 1 1512 5698 t (sigy = sigy+ty; sigxy = sigxy+$1*ty)5 1890 1 1512 5808 t (minx = min\(minx,$1\); maxx = max\(maxx,$1\))5 2160 1 1512 5918 t (})1080 6028 w (# Calculate least squares fit and draw it)7 2214 1 1080 6138 t (slope = \(n*sigxy - sigx*sigy\) / \(n*sigx2 - sigx*sigx\))8 2862 1 1080 6248 t (inter = \(sigy - slope*sigx\) / n)6 1674 1 1080 6358 t (line from minx, slope*minx+inter to maxx, slope*maxx+inter)6 3132 1 1080 6468 t 10 R f ( heights are con-)3 683( All)1 185( as a bar through the median, which is plotted as a bullet.)12 2359(It plots the extreme \256fth percentiles)5 1453 4 720 6648 t (verted to feet before plotting and calculating the regression line.)9 2556 1 720 6768 t cleartomark showpage saveobj restore %%EndPage: 17 19 %%Page: 18 20 /saveobj save def mark 20 pagesetup 10 R f (- 18 -)2 216 1 2952 480 t 2484 840 2484 2280 Dl 4644 840 2484 840 Dl 4644 2280 4644 840 Dl 2484 2280 4644 2280 Dl 2972 2352 2972 2280 Dl (5)2947 2462 w 3564 2352 3564 2280 Dl (10)3514 2462 w 4155 2352 4155 2280 Dl (15)4105 2462 w 2412 2084 2484 2084 Dl (3)2337 2104 w 2412 1717 2484 1717 Dl (4)2337 1737 w 2412 1351 2484 1351 Dl (5)2337 1371 w 2412 985 2484 985 Dl (6)2337 1005 w (Heights in Feet)2 611 1 1603 1460 t (\(Median and)1 507 1 1655 1580 t (\256fth percentiles\))1 657 1 1580 1700 t (Heights of Boys in U.S., ages 2 to 18)8 1486 1 2821 2600 t 2616 2048 2616 2191 Dl 10 S f (\267)2593 2168 w 2735 1957 2735 2113 Dl (\267)2712 2071 w 2853 1862 2853 2031 Dl (\267)2830 1975 w 2972 1777 2972 1957 Dl (\267)2949 1891 w 3090 1699 3090 1889 Dl (\267)3067 1816 w 3209 1624 3209 1824 Dl (\267)3186 1749 w 3327 1552 3327 1763 Dl (\267)3304 1685 w 3445 1480 3445 1706 Dl (\267)3422 1623 w 3564 1403 3564 1648 Dl (\267)3541 1559 w 3682 1322 3682 1589 Dl (\267)3659 1489 w 3800 1233 3800 1529 Dl (\267)3777 1412 w 3918 1142 3918 1465 Dl (\267)3895 1331 w 4037 1059 4037 1394 Dl (\267)4014 1252 w 4155 997 4155 1318 Dl (\267)4132 1180 w 4274 954 4274 1246 Dl (\267)4251 1126 w 4392 932 4392 1201 Dl (\267)4369 1094 w 4511 928 4511 1191 Dl (\267)4488 1087 w 4511 976 2616 2086 Dl 10 I f (Grap)970 2874 w 10 CW f (print)1209 2874 w 10 R f (statements write on)2 783 1 1537 2874 t 10 CW f (stderr)2348 2874 w 10 R f (as they are processed by)4 985 1 2737 2874 t 10 I f (grap)3751 2874 w 10 R f (; their single argument can be either)6 1460 1 3940 2874 t ( The)1 206(an expression or a string.)4 1005 2 720 2994 t 10 CW f (print)1957 2994 w 10 R f (statements \(which are commented out in the above)7 2034 1 2283 2994 t 10 I f (grap)4343 2994 w 10 R f ( time)1 203(program\) at one)2 639 2 4558 2994 t (showed that the regression line is)5 1329 1 720 3114 t 10 I f (Height in Feet)2 609 1 2331 3294 t 10 S f (=)2989 3294 w 10 R f (2. 61)1 183 1 3093 3294 t 10 S f (+)3325 3294 w 10 I f (.)3429 3294 w 10 R f (19)3462 3294 w 10 S f (\264)3570 3294 w 10 I f (Age)3633 3294 w 10 R f ( boys between 3 and 16, you may safely assume that they started out life at 2 feet 7 inches)19 3689(Thus for most American)3 991 2 720 3474 t (and grew at the rate of two and a quarter inches per year.)12 2267 1 720 3594 t ( probably misapplies)2 847(This program)1 547 2 970 3750 t 10 I f (grap)2396 3750 w 10 R f (; if you really want to perform least squares regressions on data, you)12 2815 1 2585 3750 t (should usually use a simple)4 1100 1 720 3870 t 10 I f (awk)1845 3870 w 10 R f (program like)1 513 1 2031 3870 t 9 CW f (awk ')1 270 1 1080 4040 t ({ x+=$1; x2+=$1*$1; y+=$2; xy+=$1*$2 })5 2052 1 1512 4150 t ( slope=\(NR*xy-x*y\)/\(NR*x2-x*x\); print \(y-slope*x\)/NR, slope })5 3294(END {)1 486 2 1080 4260 t (' $*)1 216 1 1080 4370 t 10 R f (\(Be warned, though, that this program is not numerically robust.\))9 2603 1 720 4550 t ( from J. W. Tukey's)4 868(While we're on the subject of \256tting straight lines to data, we'll redraw three graphs)14 3562 2 970 4706 t 10 I f ( Analysis)1 369(Exploratory Data)1 714 2 720 4826 t 10 R f ( \256le)1 158(. The)1 235 2 1803 4826 t 10 CW f (usapop.d)2226 4826 w 10 R f (records the population of the United States in millions at ten-year)10 2664 1 2736 4826 t (intervals.)720 4946 w 9 CW f (1790 3.93)1 594 1 1080 5116 t (1800 5.31)1 594 1 1080 5226 t (1810 7.24)1 594 1 1080 5336 t (1820 9.64)1 594 1 1080 5446 t (1830 12.87)1 594 1 1080 5556 t (...)1080 5666 w (1950 150.7)1 540 1 1080 5776 t 10 R f ( growth was linear while the early growth was exponential.)9 2380(Tukey's \256rst two graphs indicate that the later population)8 2300 2 720 5956 t (The following)1 571 1 720 6076 t 10 I f (grap)1318 6076 w 10 R f ( using)1 243(program plots them as a pair,)5 1175 2 1534 6076 t 10 CW f (graph)2978 6076 w 10 R f (commands to place internally unrelated graphs adja-)6 2096 1 3304 6076 t (cent to one another.)3 787 1 720 6196 t cleartomark showpage saveobj restore %%EndPage: 18 20 %%Page: 19 21 /saveobj save def mark 21 pagesetup 10 R f (- 19 -)2 216 1 2952 480 t 9 CW f (graph Linear)1 648 1 1080 890 t (coord x 1785,1955 y 0,160)4 1350 1 1512 1000 t (label left "Population" "in Millions" left .2)6 2430 1 1512 1110 t (label right "Linear Scale," "Linear Fit")5 2160 1 1512 1220 t (ticks bot off)2 702 1 1512 1330 t (copy "usapop.d")1 810 1 1512 1440 t (define fit { 35 + 1.4*\($1-1870\) })6 1782 1 1512 1550 t (line from 1850,fit\(1850\) to 1950,fit\(1950\))4 2268 1 1512 1660 t (graph Exponential with .Frame.n at Linear.Frame.s -\(0,.05\))6 3132 1 1080 1770 t (coord x 1785,1955 y 3,160 log y)6 1674 1 1512 1880 t (label left "Population" "in Millions" left .2)6 2430 1 1512 1990 t (label right "Logarithmic Scale," "Exponential Fit")5 2700 1 1512 2100 t (copy "usapop.d")1 810 1 1512 2210 t (define fit { exp\(0.75 + .012*\($1-1800\)\) })6 2214 1 1512 2320 t (line from 1790,fit\(1790\) to 1920,fit\(1920\))4 2268 1 1512 2430 t 10 R f ( second graph has the northern point of its frame)9 2019( The)1 214(The statements de\256ning each graph are indented for clarity.)8 2447 3 720 2610 t (0.05 inch below the southern point of the frame of the \256rst graph; the)13 2815 1 720 2730 t 10 CW f (with)3564 2730 w 10 R f ( passed directly through to)4 1072(clause is)1 345 2 3833 2730 t 10 I f (pic)5278 2730 w 10 R f ( names of both graphs begin with capital letters to conform)10 2408( The)1 210(without being evaluated for macros or expressions.)6 2062 3 720 2850 t (to)720 2970 w 10 I f (pic)823 2970 w 10 R f (syntax for labels.)2 685 1 970 2970 t 1883 3132 1883 4572 Dl 4043 3132 1883 3132 Dl 4043 4572 4043 3132 Dl 1883 4572 4043 4572 Dl 1811 4572 1883 4572 Dl (0)1736 4592 w 1811 4122 1883 4122 Dl (50)1686 4142 w 1811 3672 1883 3672 Dl (100)1636 3692 w 1811 3222 1883 3222 Dl (150)1636 3242 w (Population)1115 3812 w (in Millions)1 443 1 1111 3932 t (Linear Scale,)1 526 1 4237 3812 t (Linear Fit)1 397 1 4302 3932 t 10 S f (\267)1924 4556 w (\267)2051 4544 w (\267)2179 4527 w (\267)2305 4505 w (\267)2432 4476 w (\267)2559 4438 w (\267)2686 4383 w (\267)2814 4309 w (\267)2940 4244 w (\267)3068 4140 w (\267)3194 4025 w (\267)3322 3908 w (\267)3449 3764 w (\267)3576 3640 w (\267)3703 3486 w (\267)3830 3401 w (\267)3957 3235 w 3979 3249 2709 4509 Dl 1883 4608 1883 6048 Dl 4043 4608 1883 4608 Dl 4043 6048 4043 4608 Dl 1883 6048 4043 6048 Dl 2074 6120 2074 6048 Dl 10 R f (1800)1974 6230 w 2709 6120 2709 6048 Dl (1850)2609 6230 w 3345 6120 3345 6048 Dl (1900)3245 6230 w 3980 6120 3980 6048 Dl (1950)3880 6230 w 1811 5862 1883 5862 Dl (5)1736 5882 w 1811 5611 1883 5611 Dl (10)1686 5631 w 1811 5361 1883 5361 Dl (20)1686 5381 w 1811 5029 1883 5029 Dl (50)1686 5049 w 1811 4777 1883 4777 Dl (100)1636 4797 w (Population)1115 5288 w (in Millions)1 443 1 1111 5408 t (Logarithmic Scale,)1 760 1 4239 5288 t (Exponential Fit)1 620 1 4309 5408 t 10 S f (\267)1924 5970 w (\267)2051 5861 w (\267)2179 5749 w (\267)2305 5645 w (\267)2432 5540 w (\267)2559 5438 w (\267)2686 5327 w (\267)2814 5216 w (\267)2940 5142 w (\267)3068 5047 w (\267)3194 4965 w (\267)3322 4897 w (\267)3449 4828 w (\267)3576 4778 w (\267)3703 4723 w (\267)3830 4697 w (\267)3957 4649 w 3598 4619 1947 5920 Dl 10 R f (Polynomial functions lie between the linear and exponential functions; Tukey shows how a seventh-degree)13 4430 1 970 6534 t (polynomial provides a better \(and longer\) \256t to the early population growth.)11 3030 1 720 6654 t cleartomark showpage saveobj restore %%EndPage: 19 21 %%Page: 20 22 /saveobj save def mark 22 pagesetup 10 R f (- 20 -)2 216 1 2952 480 t 9 CW f (label left "Population" "in Millions" left .2)6 2430 1 1080 890 t (label right "$x$ re-expressed as" "" \\)6 2052 1 1080 1000 t ("$space 0 left \( {date - 1600} over 100 right \) sup 7$" left 1.2)14 3456 1 1512 1110 t (define newx { exp\(7*\(log\(\($1-1600\)/100\)\)\) })4 2322 1 1080 1220 t (ticks bot out at newx\(1800\) "1800", newx\(1850\) "1850",\\)7 2970 1 1080 1330 t (newx\(1900\) "1900")1 918 1 1998 1440 t (copy "usapop.d" thru {)3 1188 1 1080 1550 t (if $1 <= 1900 then { bullet at newx\($1\),$2 })9 2376 1 1188 1660 t (})1080 1770 w 10 R f (This program re-expresses the)3 1226 1 720 1950 t 10 I f (x)1978 1950 w 10 R f (-axis with)1 404 1 2022 1950 t 10 I f (grap)2458 1950 w 10 R f ( an)1 127(arithmetic and uses)2 785 2 2679 1950 t 10 CW f (if)3624 1950 w 10 R f (statement to graph only part of the data)7 1623 1 3777 1950 t ( produces)1 385(\256le. It)1 264 2 720 2070 t 1535 2232 1535 3672 Dl 3695 2232 1535 2232 Dl 3695 3672 3695 2232 Dl 1535 3672 3695 3672 Dl 1463 3652 1535 3652 Dl (0)1388 3672 w 1463 3301 1535 3301 Dl (20)1338 3321 w 1463 2951 1535 2951 Dl (40)1338 2971 w 1463 2600 1535 2600 Dl (60)1338 2620 w 1463 2250 1535 2250 Dl (80)1338 2270 w (Population)767 2912 w (in Millions)1 443 1 763 3032 t 10 I f (x)3908 2852 w 10 R f (re-expressed as)1 611 1 3977 2852 t 10 S f (\354)3921 3005 w (\357)3921 3105 w (\356)3921 3205 w 10 R f (100)4153 3162 w 10 I f (date)3995 3032 w 10 S f (-)4191 3032 w 10 R f (1600)4262 3032 w 10 S1 f (_ _________)1 497 1 3980 3062 t 10 S f (\374)4487 3005 w (\357)4487 3105 w (\376)4487 3205 w 7 R f (7)4541 2943 w 10 R f 1703 3744 1703 3672 Dl (1800)1603 3854 w 2139 3744 2139 3672 Dl (1850)2039 3854 w 3563 3744 3563 3672 Dl (1900)3463 3854 w 10 S f (\267)1645 3612 w (\267)1680 3588 w (\267)1727 3554 w (\267)1789 3512 w (\267)1872 3456 w (\267)1979 3382 w (\267)2116 3274 w (\267)2290 3130 w (\267)2509 3005 w (\267)2783 2802 w (\267)3123 2577 w (\267)3540 2349 w 10 R f (The)720 4122 w 10 I f (eqn)901 4122 w 10 CW f (space 0)1 421 1 1071 4122 t 10 R f (clause is necessary to keep)4 1073 1 1518 4122 t 10 I f (eqn)2618 4122 w 10 R f (from adding extra space that would interfere with positions com-)9 2611 1 2789 4122 t (puted by)1 347 1 720 4242 t 10 I f (grap)1092 4242 w 10 R f (; see Section 4.)3 605 1 1281 4242 t (The \256le)1 308 1 970 4398 t 10 CW f (army.d)1303 4398 w 10 R f (contains four related time series describing the United States Army.)9 2707 1 1688 4398 t 9 CW f ( 249 1)2 432( .9)1 162(40 16)1 324 3 1080 4568 t ( 1)1 162(42 190 12 2867)3 756 2 1080 4678 t (43 521 36 6358 55)4 918 1 1080 4788 t (44 692 47 7144 71)4 918 1 1080 4898 t (45 772 62 7283 90)4 918 1 1080 5008 t (...)1080 5118 w ( 67)1 162(83 80 9 606)3 756 2 1080 5228 t 10 R f ( enlisted males and)3 787(The \256rst \256eld is the year; the next four \256elds give the number of male of\256cers, female of\256cers,)17 3893 2 720 5408 t ( there were no female enlisted personnel in the Army until 1943; the)12 2777( \(Actually,)1 456(enlisted females, each in thousands.)4 1447 3 720 5528 t ( 1940 and 1942 is just a placeholder, since)8 1751(value 1 in)2 406 2 720 5648 t 10 I f (grap)2909 5648 w 10 R f ( fol-)1 176( The)1 212(has no mechanism for handling missing data.\))6 1882 3 3130 5648 t (lowing)720 5768 w 10 I f (grap)1023 5768 w 10 R f (program draws the four series with four different sets of)9 2236 1 1237 5768 t 10 CW f (draw)3498 5768 w 10 R f (and)3763 5768 w 10 CW f (next)3932 5768 w 10 R f (commands.)4197 5768 w cleartomark showpage saveobj restore %%EndPage: 20 22 %%Page: 21 23 /saveobj save def mark 23 pagesetup 10 R f (- 21 -)2 216 1 2952 480 t 9 CW f (coord x 38,85 y .8,10000 log y)6 1620 1 1080 890 t (label bot "U.S. Army Personnel")4 1674 1 1080 1000 t (label left "Thousands" left .3)4 1620 1 1080 1110 t ( Officers Female)2 864( #)1 216(draw of solid)2 702 3 1080 1220 t ( Enlisted Female)2 864( #)1 162(draw ef dashed)2 756 3 1080 1330 t ( Officers Male)2 756( #)1 162(draw om dotted)2 756 3 1080 1440 t ( Enlisted Male)2 756( #)1 216(draw em solid)2 702 3 1080 1550 t (copy "army.d" thru {)3 1080 1 1080 1660 t (next of at $1,$3)3 864 1 1512 1770 t (next ef at $1,$5)3 864 1 1512 1880 t (next om at $1,$2)3 864 1 1512 1990 t (next em at $1,$4)3 864 1 1512 2100 t (})1080 2210 w (copy thru { "$1 $2" size -3 at 60,$3 } until "XXX")11 2700 1 1080 2320 t (Enlisted Men 1200)2 918 1 1080 2430 t (Male Officers 140)2 918 1 1080 2540 t (Enlisted Women 12)2 918 1 1080 2650 t (Female Officers 2.5)2 1026 1 1080 2760 t (XXX)1080 2870 w 10 R f (The program labels the lines by)5 1317 1 720 3050 t 10 CW f (copy)2073 3050 w 10 R f ( data; the program is therefore shorter to write and easier to)11 2501(ing immediate)1 586 2 2313 3050 t ( delimiter string)2 645(change. The)1 515 2 720 3170 t 10 CW f (XXX)1908 3170 w 10 R f (in the)1 228 1 2116 3170 t 10 CW f (until)2372 3170 w 10 R f ( graph: the)2 431(clause could be deleted in this)5 1216 2 2700 3170 t 10 CW f (.G2)4374 3170 w 10 R f (line also denotes the)3 819 1 4581 3170 t ( The)1 210( though that string is enclosed in quotes, it may not contain spaces.)12 2731( Even)1 260(end of data.)2 478 4 720 3290 t 10 I f (y)4430 3290 w 10 R f (-positions of the labels)3 926 1 4474 3290 t (are the result of several iterations.)5 1352 1 720 3410 t 2376 3572 2376 5012 Dl 4536 3572 2376 3572 Dl 4536 5012 4536 3572 Dl 2376 5012 4536 5012 Dl 2468 5084 2468 5012 Dl (40)2418 5194 w 2927 5084 2927 5012 Dl (50)2877 5194 w 3386 5084 3386 5012 Dl (60)3336 5194 w 3846 5084 3846 5012 Dl (70)3796 5194 w 4306 5084 4306 5012 Dl (80)4256 5194 w 2304 4978 2376 4978 Dl (1)2229 4998 w 2304 4626 2376 4626 Dl (10)2179 4646 w 2304 4274 2376 4274 Dl (100)2129 4294 w 2304 3923 2376 3923 Dl (1000)2079 3943 w (U.S. Army Personnel)2 855 1 3029 5332 t (Thousands)1584 4312 w 2560 4599 2468 4994 Dl 2504 4978 2468 4978 Dl 2559 4978 2523 4978 Dl 7 R f (.)2458 4557 w (.)2466 4523 w (.)2474 4488 w (.)2482 4454 w (.)2491 4420 w (.)2499 4385 w (.)2507 4351 w (.)2516 4317 w (.)2525 4282 w (.)2533 4248 w (.)2541 4214 w (.)2549 4179 w 10 R f 2560 3763 2468 4135 Dl 2605 4431 2559 4598 Dl 2561 4942 2559 4978 Dl 2567 4870 2565 4906 Dl 2572 4798 2570 4834 Dl 2578 4726 2576 4762 Dl 2583 4654 2581 4690 Dl 2588 4582 2586 4618 Dl 2594 4510 2592 4546 Dl 2599 4438 2597 4474 Dl 2604 4366 2602 4402 Dl 7 R f (.)2549 4179 w (.)2561 4141 w (.)2572 4102 w (.)2584 4064 w (.)2595 4025 w 10 R f 2605 3641 2559 3762 Dl 2651 4389 2605 4430 Dl 2651 4328 2605 4366 Dl 7 R f (.)2595 4025 w (.)2618 4004 w (.)2641 3982 w 10 R f 2651 3623 2605 3641 Dl 2697 4347 2651 4389 Dl 2697 4291 2651 4327 Dl 7 R f (.)2641 3982 w (.)2687 3965 w 10 R f 2697 3621 2651 3623 Dl 2743 4554 2697 4348 Dl 2703 4326 2697 4291 Dl 2716 4401 2710 4366 Dl 2730 4478 2724 4443 Dl 2743 4554 2737 4519 Dl 7 R f (.)2687 3965 w (.)2697 4001 w (.)2705 4037 w (.)2715 4073 w (.)2724 4108 w (.)2733 4144 w 10 R f 2743 3851 2697 3620 Dl 2926 4751 2743 4554 Dl 2771 4575 2743 4554 Dl 2823 4614 2795 4593 Dl 2874 4652 2846 4631 Dl 2926 4691 2898 4670 Dl 7 R f (.)2733 4144 w (.)2756 4169 w (.)2779 4195 w (.)2802 4220 w (.)2825 4246 w (.)2848 4271 w (.)2871 4297 w (.)2894 4323 w (.)2917 4348 w 10 R f 2926 4025 2743 3851 Dl 3156 4730 2927 4752 Dl 2963 4688 2927 4692 Dl 3028 4681 2992 4685 Dl 3093 4673 3057 4677 Dl 3157 4666 3121 4670 Dl 7 R f (.)2917 4348 w (.)2950 4337 w (.)2983 4325 w (.)3016 4314 w (.)3048 4302 w (.)3081 4292 w (.)3114 4280 w (.)3147 4269 w 10 R f 3156 3927 2927 4025 Dl 3386 4758 3157 4729 Dl 3193 4665 3157 4666 Dl 3258 4662 3222 4663 Dl 3322 4659 3286 4660 Dl 3386 4657 3350 4658 Dl 7 R f (.)3147 4269 w (.)3185 4274 w (.)3223 4279 w (.)3262 4284 w (.)3300 4290 w (.)3338 4295 w (.)3376 4300 w 10 R f 3386 3964 3157 3926 Dl 3615 4777 3386 4758 Dl 3422 4657 3386 4657 Dl 3487 4654 3451 4654 Dl 3552 4653 3516 4653 Dl 3616 4652 3580 4652 Dl 7 R f (.)3376 4300 w (.)3415 4297 w (.)3453 4294 w (.)3492 4290 w (.)3530 4287 w (.)3568 4284 w (.)3606 4281 w 10 R f 3615 3950 3386 3965 Dl 3845 4727 3616 4778 Dl 3651 4646 3616 4651 Dl 3716 4635 3681 4640 Dl 3781 4623 3746 4628 Dl 3845 4613 3810 4618 Dl 7 R f (.)3606 4281 w (.)3639 4273 w (.)3672 4266 w (.)3705 4259 w (.)3738 4251 w (.)3770 4243 w (.)3803 4235 w (.)3836 4228 w 10 R f 3845 3904 3616 3949 Dl 4075 4748 3846 4726 Dl 3874 4589 3846 4611 Dl 3925 4549 3897 4571 Dl 3975 4508 3947 4530 Dl 4026 4468 3998 4490 Dl 4076 4427 4048 4449 Dl 7 R f (.)3836 4228 w (.)3869 4239 w (.)3902 4249 w (.)3934 4260 w (.)3968 4271 w (.)4001 4281 w (.)4033 4292 w (.)4066 4302 w 10 R f 4075 3991 3846 3903 Dl 4305 4685 4076 4748 Dl 4110 4416 4076 4426 Dl 4175 4397 4141 4407 Dl 4240 4377 4206 4387 Dl 4305 4358 4271 4368 Dl 7 R f (.)4066 4302 w (.)4104 4305 w (.)4142 4308 w (.)4181 4311 w (.)4219 4314 w (.)4258 4317 w (.)4296 4320 w 10 R f 4305 3998 4076 3991 Dl 4443 4643 4306 4685 Dl 4341 4353 4306 4358 Dl 4443 4336 4408 4341 Dl 7 R f (.)4296 4320 w (.)4330 4318 w (.)4365 4315 w (.)4399 4313 w (.)4433 4312 w 10 R f 4443 3999 4306 3999 Dl 7 R f (Enlisted Men)1 377 1 3198 3916 t (Male Of\256cers)1 386 1 3193 4243 t (Enlisted Women)1 471 1 3151 4618 t (Female Of\256cers)1 449 1 3162 4857 t 10 R f ( World War is obvious, as is the exodus after the)10 1954(This data can tell many stories: the buildup during the Second)10 2476 2 970 5606 t ( will consider a different story: the ratio of enlisted)9 2069( We)1 192( and Vietnam are also apparent.)5 1283(war; increases during Korea)3 1136 4 720 5726 t ( are several ways to plot this data \(the most obvious graph uses)12 2615( There)1 290( of personnel.)2 562(men to the three other classes)5 1213 4 720 5846 t (three time series showing how the ratios change over time, and is left as an exercise for the reader\).)18 3962 1 720 5966 t ( method that is)3 604(We will instead construct a graph that gives little insight into this data, but illustrates a general)16 3826 2 970 6122 t (quite useful in conjunction with)4 1280 1 720 6242 t 10 I f (grap)2027 6242 w 10 R f ( one variable \(the number)4 1029( graph is a ``scatterplot vector'' that shows how)8 1923(. The)1 232 3 2216 6242 t ( with tradition, we \256rst show the \256nal graphs, all of)10 2069( Breaking)1 418( other three.)2 483(of enlisted men\) varies as a function of the)8 1710 4 720 6362 t (which have logarithmic scales.)3 1231 1 720 6482 t cleartomark showpage saveobj restore %%EndPage: 21 23 %%Page: 22 24 /saveobj save def mark 24 pagesetup 10 R f (- 22 -)2 216 1 2952 480 t 1548 840 1548 2040 Dl 2748 840 1548 840 Dl 2748 2040 2748 840 Dl 1548 2040 2748 2040 Dl (Male)1859 2359 w 10 S f (_)2064 2359 w 10 R f (Of\256cers)2114 2359 w (Enlisted)836 1459 w 10 S f (_)1164 1459 w 10 R f (Men)1214 1459 w 7 R f (40)1586 1986 w (42)2258 1224 w (43)2532 975 w (44)2609 939 w (45)2639 933 w (46)2322 1405 w (50)1958 1761 w (55)2099 1559 w (60)2043 1638 w (65)2078 1605 w (70)2171 1511 w (75)2040 1692 w (80 83)1 84 1 2009 1708 t 10 R f 2820 840 2820 2040 Dl 4020 840 2820 840 Dl 4019 2040 4019 840 Dl 2819 2040 4019 2040 Dl (Female)3088 2359 w 10 S f (_)3382 2359 w 10 R f (Of\256cers)3432 2359 w 7 R f (40)2858 1986 w (42)3503 1224 w (43)3775 975 w (44)3842 939 w (45)3911 933 w (46)3574 1405 w (50)3253 1761 w (55)3289 1559 w (60)3241 1638 w (65)3210 1605 w (70)3295 1511 w (75)3259 1692 w (8083)3361 1708 w 10 R f 4091 840 4091 2040 Dl 5291 840 4091 840 Dl 5292 2040 5292 840 Dl 4092 2040 5292 2040 Dl (Enlisted)4345 2359 w 10 S f (_)4673 2359 w 10 R f (Women)4723 2359 w 7 R f (40)4130 1986 w (42)4130 1224 w (43)5068 975 w (44)5128 939 w (45)5183 933 w (46)4778 1405 w (50)4568 1761 w (55)4608 1559 w (60)4622 1638 w (65)4631 1605 w (70)4691 1511 w (75)4975 1692 w (80 83)1 104 1 5080 1708 t 10 R f ( of enlisted men is almost linearly related to the number of male of\256cers, it is somewhat related to the)19 4189(The number)1 491 2 720 2598 t (number of female of\256cers, and it varies widely as a function of the number of enlisted women.)16 3776 1 720 2718 t ( wrote a miniature ``com-)4 1029( We)1 189( interesting than the graph itself is the method we used to produce it.)13 2749(Much more)1 463 4 970 2874 t ( description of a scatterplot vector and produces as ``object code'' a)11 2783(piler'' that accepts as its ``source language'' a)7 1897 2 720 2994 t 10 I f (grap)720 3114 w 10 R f ( source program for the above example is)7 1654( The)1 205(program to draw the graph.)4 1089 3 934 3114 t 9 CW f (file "army.d")1 702 1 1080 3284 t (log x log y)3 594 1 1080 3394 t (symbol "\\s-3$1\\s+3")1 1026 1 1080 3504 t (y $4 Enlisted_Men)2 918 1 1080 3614 t (x $2 Male_Officers)2 972 1 1080 3724 t (x $3 Female_Officers)2 1080 1 1080 3834 t (x $5 Enlisted_Women)2 1026 1 1080 3944 t 10 R f (The program lists several global attributes of the graph, the)9 2408 1 720 4124 t 10 I f (y)3158 4124 w 10 R f (-variable to be plotted, and as many)6 1464 1 3202 4124 t 10 I f (x)4697 4124 w 10 R f (-variables as are)2 659 1 4741 4124 t ( language is ``compiled'' by the follow-)6 1597( The)1 205( and a descriptive string.)4 979(desired; with each variable is its \256eld in the \256le)9 1899 4 720 4244 t (ing)720 4364 w 10 I f (awk)873 4364 w 10 R f (program.)1059 4364 w 9 CW f (awk ')1 270 1 1080 4534 t (# Parse all commands)3 1080 1 1080 4644 t ( fname = $2 })4 702( {)1 270($1 == "file")2 648 3 1080 4754 t ( logtext = $0 })4 810( {)1 324($1 == "log")2 594 3 1080 4864 t ( symtext = $2 })4 810( {)1 162($1 == "symbol")2 756 3 1080 4974 t ( yfield = $2; ylabel = $3 })7 1458( {)1 432($1 == "y")2 486 3 1080 5084 t ( n++; xfield[n] = $2; xlabel[n] = $3 })8 2052( {)1 432($1 == "x")2 486 3 1080 5194 t (# Generate n graphs)3 1026 1 1080 5304 t ( ".G1")1 324( print)1 432(END {)1 270 3 1080 5414 t (for \(i = 1; i <= n; i++\) {)8 1404 1 1512 5524 t (if \(s != ""\) print "#")5 1188 1 1944 5634 t (print "graph A" s)3 918 1 1944 5744 t (s = " with .Frame.w at A.Frame.e +\(.1,0\)")7 2214 1 1944 5854 t (print "frame ht " 5/n " wid " 5/n)8 1782 1 1944 5964 t (print "label bot \\"" xlabel[i] "\\"")5 1890 1 1944 6074 t (if \(i == 1\) print "label left \\"" ylabel "\\"")9 2430 1 1944 6184 t (if \(logtext != ""\) print "coord " logtext)7 2214 1 1944 6294 t (print "ticks off")2 918 1 1944 6404 t (print "copy " fname " thru { " symtext\\)8 2106 1 1944 6514 t (" at " xfield[i] "," yfield " }")7 1728 1 2376 6624 t (})1512 6734 w (print ".G2")1 594 1 1512 6844 t (})1080 6954 w (' $1)1 216 1 1080 7064 t 10 R f ( directly to)2 451(Running this program on the above description produces the following output, which is typically piped)14 4229 2 720 7244 t cleartomark showpage saveobj restore %%EndPage: 22 24 %%Page: 23 25 /saveobj save def mark 25 pagesetup 10 R f (- 23 -)2 216 1 2952 480 t 10 I f (grap)720 840 w 10 R f (.)909 840 w 9 CW f (graph A)1 378 1 1080 1010 t (frame ht 1.66667 wid 1.66667)4 1512 1 1080 1120 t (label bot "Male_Officers")2 1350 1 1080 1230 t (label left "Enlisted_Men")2 1350 1 1080 1340 t (coord log x log y)4 918 1 1080 1450 t (ticks off)1 486 1 1080 1560 t (copy "army.d" thru { "\\s-3$1\\s+3" at $2,$4 })7 2376 1 1080 1670 t (#)1080 1780 w (graph A with .Frame.w at A.Frame.e +\(.1,0\))6 2268 1 1080 1890 t (frame ht 1.66667 wid 1.66667)4 1512 1 1080 2000 t (label bot "Female_Officers")2 1458 1 1080 2110 t (coord log x log y)4 918 1 1080 2220 t (ticks off)1 486 1 1080 2330 t (copy "army.d" thru { "\\s-3$1\\s+3" at $3,$4 })7 2376 1 1080 2440 t (#)1080 2550 w (graph A with .Frame.w at A.Frame.e +\(.1,0\))6 2268 1 1080 2660 t (frame ht 1.66667 wid 1.66667)4 1512 1 1080 2770 t (label bot "Enlisted_Women")2 1404 1 1080 2880 t (coord log x log y)4 918 1 1080 2990 t (ticks off)1 486 1 1080 3100 t (copy "army.d" thru { "\\s-3$1\\s+3" at $5,$4 })7 2376 1 1080 3210 t 10 R f (The generated program uses the)4 1274 1 720 3390 t 10 I f (pic)2019 3390 w 10 R f (trick of re-using the same name \()6 1319 1 2166 3390 t 10 CW f (A)3485 3390 w 10 R f (\) for several objects.)3 814 1 3545 3390 t ( useful preprocessors for)3 1022(Although the program above is merely a toy, ``minicompilers'' can produce)10 3156 2 970 3546 t 10 I f (grap)5186 3546 w 10 R f (.)5375 3546 w (The)720 3666 w 10 CW f (scatmat)906 3666 w 10 R f (program, for instance, is a 90-line)5 1380 1 1357 3666 t 10 I f (awk)2768 3666 w 10 R f ( as)1 113(program that reads a simple input language and produces)8 2327 2 2960 3666 t (output a)1 333 1 720 3786 t 10 I f (grap)1086 3786 w 10 R f ( is a handy graphical device for spotting pairwise)8 2035(program to produce a ``scatterplot matrix'', which)6 2057 2 1308 3786 t ( If)1 122(interactions among several variables.)3 1498 2 720 3906 t 10 I f (grap)2371 3906 w 10 R f ( feature you desire, consider building a simple preprocessor to)9 2529(lacks a)1 280 2 2591 3906 t ( which approach is best depends strongly on the job you)10 2312( alternative is to de\256ne macros for the task;)8 1773( An)1 178(provide it.)1 417 4 720 4026 t (wish to accomplish.)2 797 1 720 4146 t ( its ``data'' is a func-)5 869( Rather,)1 347(The next graph uses iterators to make a graph without reading data from a \256le.)14 3214 3 970 4302 t ( one variable that describes one solution to the)8 1861(tion of two variables that describes a derivative \256eld and a function of)12 2819 2 720 4422 t (differential equation.)1 837 1 720 4542 t 9 CW f (frame ht 2.5 wid 2.5)4 1080 1 1080 4712 t (coord x 0,1 y 0,1)4 918 1 1080 4822 t (label bot "Direction field is $y sup prime = x sup 2 / y$")13 3132 1 1080 4932 t (label left "$y = sqrt {\(2x sup 3 +1\)/3}$" right .3)10 2700 1 1080 5042 t (ticks left in 0 at 0,1)5 1188 1 1080 5152 t (ticks bot in 0 at 0,1)5 1134 1 1080 5262 t (len = .04)2 486 1 1080 5372 t (for tx from .01 to .91 by .1 do {)9 1782 1 1080 5482 t (for ty from .01 to .91 by .1 do {)9 1782 1 1512 5592 t (deriv = tx*tx/ty)2 864 1 1944 5702 t (scale = len/sqrt\(1+deriv*deriv\))2 1674 1 1944 5812 t (line from tx,ty to tx+scale,ty+scale*deriv)4 2268 1 1944 5922 t (})1512 6032 w (})1080 6142 w (draw solid)1 540 1 1080 6252 t (for tx = 0 to 1 by .05 do {)9 1458 1 1080 6362 t (next at tx, sqrt\(\(2*tx*tx*tx+1\)/3\))3 1836 1 1512 6472 t (})1080 6582 w 10 R f (The left label uses)3 753 1 720 6762 t 10 I f (eqn)1506 6762 w 10 R f (text between the)2 670 1 1683 6762 t 10 CW f ($$)2387 6762 w 10 R f ( variable)1 355(delimiters. The)1 639 2 2541 6762 t 10 CW f (scale)3569 6762 w 10 R f (ensures that all lines in the direction)6 1497 1 3903 6762 t ( The)1 210(\256eld are the same length.)4 1021 2 720 6882 t 10 CW f (in)1981 6882 w 10 R f (clauses in the)2 546 1 2131 6882 t 10 CW f (ticks)2706 6882 w 10 R f (statements specify that the ticks go in zero inches to avoid)10 2365 1 3035 6882 t ( variables)1 385(overprinting. The)1 724 2 720 7002 t 10 CW f (tx)1854 7002 w 10 R f (and)1999 7002 w 10 CW f (ty)2168 7002 w 10 R f (are so named because)3 866 1 2313 7002 t 10 CW f (x)3204 7002 w 10 R f (and)3289 7002 w 10 CW f (y)3458 7002 w 10 R f (are reserved words for the)4 1040 1 3543 7002 t 10 CW f (coord)4608 7002 w 10 R f (statement.)4933 7002 w cleartomark showpage saveobj restore %%EndPage: 23 25 %%Page: 24 26 /saveobj save def mark 26 pagesetup 10 R f (- 24 -)2 216 1 2952 480 t 2796 899 2796 2699 Dl 4596 899 2796 899 Dl 4596 2699 4596 899 Dl 2796 2699 4596 2699 Dl (Direction \256eld is)2 672 1 3167 3020 t 10 I f (y)3864 3020 w 10 S f (\242)3919 3015 w (=)3968 3020 w 10 I f (x)4039 3020 w 7 R f (2)4094 2980 w 10 I f (/ y)1 80 1 4145 3020 t (y)1846 1837 w 10 S f (=)1914 1837 w 12 S f (\326` ````````)1 551 1 1985 1837 t 10 R f (\( 2)1 91 1 2059 1837 t 10 I f (x)2158 1837 w 7 R f (3)2213 1797 w 10 S f (+)2272 1837 w 10 R f (1 \))1 91 1 2343 1837 t 10 I f (/)2442 1837 w 10 R f (3)2478 1837 w 2796 2717 1 1 De (0)2721 2737 w 2796 917 1 1 De (1)2721 937 w 2796 2717 1 1 De (0)2771 2827 w 4596 2717 1 1 De (1)4571 2827 w 2886 2699 2814 2699 Dl 2886 2519 2814 2519 Dl 2886 2339 2814 2339 Dl 2886 2159 2814 2159 Dl 2886 1979 2814 1979 Dl 2886 1799 2814 1799 Dl 2886 1619 2814 1619 Dl 2886 1439 2814 1439 Dl 2886 1259 2814 1259 Dl 2886 1079 2814 1079 Dl 3040 2644 2994 2699 Dl 3065 2512 2994 2519 Dl 3066 2335 2994 2339 Dl 3066 2157 2994 2159 Dl 3066 1977 2994 1979 Dl 3066 1798 2994 1799 Dl 3066 1618 2994 1619 Dl 3066 1438 2994 1439 Dl 3066 1259 2994 1259 Dl 3066 1079 2994 1079 Dl 3189 2629 3174 2699 Dl 3240 2493 3174 2519 Dl 3244 2324 3174 2339 Dl 3245 2149 3174 2159 Dl 3245 1972 3174 1979 Dl 3246 1793 3174 1799 Dl 3246 1614 3174 1619 Dl 3246 1435 3174 1439 Dl 3246 1256 3174 1259 Dl 3246 1076 3174 1079 Dl 3361 2628 3354 2699 Dl 3408 2472 3354 2519 Dl 3419 2309 3354 2339 Dl 3423 2138 3354 2159 Dl 3423 1963 3354 1979 Dl 3424 1786 3354 1799 Dl 3425 1608 3354 1619 Dl 3425 1430 3354 1439 Dl 3425 1251 3354 1259 Dl 3425 1072 3354 1079 Dl 3538 2627 3534 2699 Dl 3573 2459 3534 2519 Dl 3590 2295 3534 2339 Dl 3597 2125 3534 2159 Dl 3600 1952 3534 1979 Dl 3602 1777 3534 1799 Dl 3603 1600 3534 1619 Dl 3603 1423 3534 1439 Dl 3604 1245 3534 1259 Dl 3604 1067 3534 1079 Dl 3716 2627 3714 2699 Dl 3742 2453 3714 2519 Dl 3759 2283 3714 2339 Dl 3769 2113 3714 2159 Dl 3774 1941 3714 1979 Dl 3778 1767 3714 1799 Dl 3780 1591 3714 1619 Dl 3781 1415 3714 1439 Dl 3782 1237 3714 1259 Dl 3783 1060 3714 1079 Dl 3896 2627 3894 2699 Dl 3914 2450 3894 2519 Dl 3929 2277 3894 2339 Dl 3940 2104 3894 2159 Dl 3947 1931 3894 1979 Dl 3952 1757 3894 1799 Dl 3955 1582 3894 1619 Dl 3958 1406 3894 1439 Dl 3959 1229 3894 1259 Dl 3960 1052 3894 1079 Dl 4075 2627 4074 2699 Dl 4089 2449 4074 2519 Dl 4101 2273 4074 2339 Dl 4111 2098 4074 2159 Dl 4119 1923 4074 1979 Dl 4125 1749 4074 1799 Dl 4129 1573 4074 1619 Dl 4133 1398 4074 1439 Dl 4135 1221 4074 1259 Dl 4136 1045 4074 1079 Dl 4255 2627 4254 2699 Dl 4266 2448 4254 2519 Dl 4275 2271 4254 2339 Dl 4284 2095 4254 2159 Dl 4292 1918 4254 1979 Dl 4297 1743 4254 1799 Dl 4302 1567 4254 1619 Dl 4306 1391 4254 1439 Dl 4310 1214 4254 1259 Dl 4312 1038 4254 1079 Dl 4434 2627 4434 2699 Dl 4443 2448 4434 2519 Dl 4452 2270 4434 2339 Dl 4459 2092 4434 2159 Dl 4465 1915 4434 1979 Dl 4471 1738 4434 1799 Dl 4476 1561 4434 1619 Dl 4480 1385 4434 1439 Dl 4484 1208 4434 1259 Dl 4487 1031 4434 1079 Dl 2886 1678 2796 1678 Dl 2976 1678 2886 1678 Dl 3066 1676 2976 1678 Dl 3156 1670 3066 1675 Dl 3246 1663 3156 1670 Dl 3336 1651 3246 1662 Dl 3426 1635 3336 1650 Dl 3516 1614 3426 1634 Dl 3606 1589 3516 1614 Dl 3696 1557 3606 1588 Dl 3786 1518 3696 1556 Dl 3876 1475 3786 1518 Dl 3966 1425 3876 1474 Dl 4056 1368 3966 1424 Dl 4146 1307 4056 1368 Dl 4236 1239 4146 1306 Dl 4326 1167 4236 1239 Dl 4416 1089 4326 1166 Dl 4506 1006 4416 1088 Dl 4596 918 4506 1005 Dl ( Because)1 383( point arithmetic may be surprised that the above graph is correct.)11 2634(Programmers familiar with \257oating)3 1413 3 970 3311 t (of roundoff error, iteration ``)4 1185 1 720 3431 t 10 CW f ( .05)1 248(from 0 to 1 by)4 876 2 1905 3431 t 10 R f ( ,)1 33('' usually produces the values 0)5 1307 2 3029 3431 t 10 I f (.)4410 3431 w 10 R f (05 ,)1 133 1 4443 3431 t 10 I f (.)4617 3431 w 10 R f (10 ,)1 133 1 4650 3431 t 10 I f (.)4824 3431 w 10 R f (.. ,)1 83 1 4849 3431 t 10 I f (.)4973 3431 w 10 R f (95.)5006 3431 w 10 I f (Grap)5189 3431 w 10 R f (uses a ``fuzzy test'' in the)5 1048 1 720 3551 t 10 CW f (for)1796 3551 w 10 R f ( Such)1 254( that problem, which may in turn introduce other problems.)9 2403(statement to avoid)2 739 3 2004 3551 t (problems may be avoided by iterating over an integer range and incrementing a non-integer value within the loop.)17 4553 1 720 3671 t ( an example of one-)4 872( As)1 181(Most of the data we have seen so far is inherently two \(or more\) dimensional.)14 3377 3 970 3827 t ( in the \256le)3 415(dimensional data, we will return to the populations of the \256fty states, which is the third \256eld)16 3756 2 720 3947 t 10 CW f (states.d)4920 3947 w 10 R f ( \256rst graph takes the most space, but it also)9 1721( Our)1 205(introduced earlier; the \256le is sorted in increasing order of population.)10 2754 3 720 4067 t (gives the most information.)3 1100 1 720 4187 t 9 CW f (frame ht 4 wid 5)4 864 1 1080 4357 t (label left "Rank in" "Population")4 1782 1 1080 4467 t (label bot "Population \(Millions\)")3 1782 1 1080 4577 t (label top "$log sub 2$ \(Population\)")5 1944 1 1080 4687 t (coord x .3,30 y 0,51 log x)6 1404 1 1080 4797 t (define L { \(2.0\303$1\)/1e6 "$1" })5 1620 1 1080 4907 t (ticks bot out at .5, 1, 2, 5, 10, 20)9 1944 1 1080 5017 t (ticks left out from 10 to 50 by 10)8 1836 1 1080 5127 t (ticks top out at L\(19\), L\(20\), L\(21\), L\(22\), L\(23\), L\(24\))9 3078 1 1080 5237 t (thisy = 50)2 540 1 1080 5347 t (copy "states.d" thru {)3 1188 1 1080 5457 t ("$1" size -4 at \($3/1e6, thisy\))5 1674 1 1512 5567 t (thisy = thisy-1)2 810 1 1512 5677 t (})1080 5787 w (line dotted from 15.3,1 to .515,50)5 1836 1 1080 5897 t 10 R f (The)720 6077 w 10 CW f (L)906 6077 w 10 R f (macro \(for Label\) with input parameter)5 1595 1 997 6077 t 10 I f (X)2623 6077 w 10 R f (evaluates to the number 2)4 1050 1 2715 6077 t 7 I f (X)3770 6037 w 10 I f (/)3829 6077 w 10 R f ( followed by the string ")5 1001(1 , 000 , 000)4 432 2 3865 6077 t 10 I f (X)5298 6077 w 10 R f (")5359 6077 w (\(the)720 6197 w 10 CW f (ticks)900 6197 w 10 R f (command expects a number followed by a string label\).)8 2221 1 1225 6197 t cleartomark showpage saveobj restore %%EndPage: 24 26 %%Page: 25 27 /saveobj save def mark 27 pagesetup 10 R f (- 25 -)2 216 1 2952 480 t 1572 1200 1572 4080 Dl 5172 1200 1572 1200 Dl 5172 4080 5172 1200 Dl 1572 4080 5172 4080 Dl (Rank in)1 314 1 1030 2600 t (Population)970 2720 w (Population \(Millions\))1 865 1 2940 4400 t (log)3019 919 w 7 R f (2)3158 939 w 10 R f (\(Population\))3226 919 w 1971 4152 1971 4080 Dl (0.5)1909 4262 w 2513 4152 2513 4080 Dl (1)2488 4262 w 3054 4152 3054 4080 Dl (2)3029 4262 w 3771 4152 3771 4080 Dl (5)3746 4262 w 4313 4152 4313 4080 Dl (10)4263 4262 w 4854 4152 4854 4080 Dl (20)4804 4262 w 1500 3515 1572 3515 Dl (10)1375 3535 w 1500 2950 1572 2950 Dl (20)1375 2970 w 1500 2385 1572 2385 Dl (30)1375 2405 w 1500 1821 1572 1821 Dl (40)1375 1841 w 1500 1256 1572 1256 Dl (50)1375 1276 w 2008 1128 2008 1200 Dl (19)1958 1076 w 2550 1128 2550 1200 Dl (20)2500 1076 w 3092 1128 3092 1200 Dl (21)3042 1076 w 3634 1128 3634 1200 Dl (22)3584 1076 w 4175 1128 4175 1200 Dl (23)4125 1076 w 4717 1128 4717 1200 Dl (24)4667 1076 w 6 R f (AK)1757 1276 w (WY)1873 1333 w (VT)1949 1389 w (DE)2066 1446 w (ND)2136 1502 w (SD)2185 1559 w (MT)2280 1615 w (NV)2296 1671 w (NH)2405 1728 w (ID)2436 1784 w (RI)2440 1841 w (HI)2454 1897 w (ME)2559 1954 w (NM)2671 2010 w (UT)2769 2066 w (NE)2825 2123 w (WV)2986 2179 w (AR)3118 2236 w (KS)3147 2292 w (MS)3193 2349 w (OR)3229 2405 w (AZ)3255 2462 w (CO)3301 2518 w (IA)3318 2575 w (OK)3335 2631 w (CT)3361 2688 w (SC)3366 2744 w (KY)3484 2801 w (AL)3536 2858 w (MN)3563 2914 w (WA)3573 2970 w (LA)3596 3027 w (MD)3589 3083 w (TN)3664 3140 w (WI)3685 3196 w (MO)3710 3253 w (VA)3780 3309 w (GA)3797 3365 w (IN)3813 3422 w (MA)3831 3478 w (NC)3857 3535 w (NJ)4041 3591 w (MI)4217 3648 w (FL)4258 3704 w (OH)4330 3760 w (IL)4389 3817 w (PA)4408 3873 w (TX)4549 3930 w (NY)4710 3986 w (CA)4945 4043 w 7 R f (.)4635 4026 w (.)4610 4000 w (.)4585 3974 w (.)4560 3948 w (.)4535 3922 w (.)4510 3895 w (.)4485 3869 w (.)4460 3843 w (.)4435 3818 w (.)4410 3791 w (.)4385 3765 w (.)4360 3739 w (.)4335 3712 w (.)4310 3687 w (.)4285 3661 w (.)4260 3635 w (.)4235 3608 w (.)4210 3582 w (.)4185 3556 w (.)4160 3530 w (.)4135 3504 w (.)4110 3478 w (.)4085 3452 w (.)4060 3426 w (.)4035 3399 w (.)4010 3373 w (.)3985 3347 w (.)3960 3321 w (.)3935 3295 w (.)3910 3269 w (.)3884 3243 w (.)3860 3217 w (.)3835 3190 w (.)3810 3165 w (.)3785 3139 w (.)3760 3113 w (.)3735 3086 w (.)3710 3060 w (.)3685 3034 w (.)3660 3008 w (.)3635 2982 w (.)3609 2956 w (.)3585 2930 w (.)3560 2904 w (.)3535 2877 w (.)3509 2851 w (.)3485 2825 w (.)3460 2799 w (.)3434 2773 w (.)3409 2747 w (.)3385 2721 w (.)3360 2695 w (.)3334 2668 w (.)3309 2643 w (.)3285 2617 w (.)3260 2590 w (.)3234 2564 w (.)3210 2538 w (.)3185 2512 w (.)3159 2486 w (.)3134 2460 w (.)3110 2434 w (.)3085 2408 w (.)3059 2381 w (.)3034 2355 w (.)3010 2329 w (.)2984 2303 w (.)2959 2277 w (.)2934 2251 w (.)2910 2225 w (.)2884 2199 w (.)2859 2172 w (.)2834 2146 w (.)2810 2121 w (.)2784 2095 w (.)2759 2068 w (.)2735 2042 w (.)2709 2016 w (.)2684 1990 w (.)2659 1964 w (.)2635 1938 w (.)2609 1912 w (.)2584 1886 w (.)2559 1859 w (.)2534 1833 w (.)2509 1807 w (.)2484 1781 w (.)2459 1755 w (.)2434 1729 w (.)2409 1703 w (.)2384 1677 w (.)2359 1650 w (.)2334 1624 w (.)2309 1599 w (.)2284 1573 w (.)2259 1546 w (.)2234 1520 w (.)2209 1494 w (.)2184 1467 w (.)2159 1442 w (.)2134 1416 w (.)2109 1390 w (.)2084 1363 w (.)2059 1337 w (.)2034 1311 w (.)2009 1285 w (.)1984 1259 w 10 R f (The dotted line is the least squares regression)7 1811 1 720 4638 t (log)2234 4818 w 7 R f (10)2373 4838 w 10 I f (Population)2492 4818 w 10 S f (=)2986 4818 w 10 R f (7. 214)1 233 1 3090 4818 t 10 S f (-)3372 4818 w 10 I f (.)3476 4818 w 10 R f (03)3509 4818 w 10 S f (\264)3617 4818 w 10 I f (Rank)3680 4818 w 10 R f ( population of the largest state and .515 million as the population of the smallest)14 3375(which gives 15.3 million as the)5 1305 2 720 4998 t ( sloppy as)2 400( As)1 161( by a factor of two every ten states \(compare the top and left scales\).)14 2723( says that population drops)4 1076(state. It)1 320 5 720 5118 t ( it is a much better \256t to this data than a Zipf's Law curve is \(drawing that curve is left)20 3505(the exponential \256t is, though,)4 1175 2 720 5238 t (as an exercise for the reader\).)5 1172 1 720 5358 t (The next graph is a more standard representation of one-dimensional data.)10 2963 1 970 5514 t 9 CW f (frame invis ht .3 wid 5 bottom solid)7 1944 1 1080 5684 t (label bot "Populations \(in Millions\) of the 50 States")8 2916 1 1080 5794 t (coord x .3,30 y 0, 1 log x)7 1404 1 1080 5904 t (ticks bot out at .5, 1, 2, 5, 10, 20)9 1944 1 1080 6014 t (ticks left off)2 756 1 1080 6124 t (copy "states.d" thru { vtick at \($3/1e6,.5\) })7 2430 1 1080 6234 t 10 R f (The markers were chosen to be)5 1243 1 720 6414 t 10 CW f (vticks)1988 6414 w 10 R f (because they denote only an)4 1125 1 2373 6414 t 10 I f (x)3523 6414 w 10 R f (-value.)3567 6414 w 4860 6792 1260 6792 Dl (Populations \(in Millions\) of the 50 States)6 1651 1 2235 7112 t 1659 6864 1659 6792 Dl (0.5)1597 6974 w 2201 6864 2201 6792 Dl (1)2176 6974 w 2743 6864 2743 6792 Dl (2)2718 6974 w 3459 6864 3459 6792 Dl (5)3434 6974 w 4001 6864 4001 6792 Dl (10)3951 6974 w 4543 6864 4543 6792 Dl (20)4493 6974 w 10 S f ( |)1 234( |)1 164( |)1 142( |)1 29( |)1 44( |)1 81( |)1 39( |)1 179( |)1 176( ||)1 54( |)1 4( |)1 17( |)1 66( |)1 33( ||)1 86( |)1 2( |)1 14( |)1 11( |)1 36( |)1 48( |)1 125( |)1 4( ||)1 50( |)1 6( |)1 48( |)1 25( |)1 34( |)1 50( |)1 26( |)1 124( |)1 170( |)1 56( |)1 90( |)1 114( |)1 121( |)1 14( |)1 2( ||)1 129( |)1 14( |)1 101( |)1 45( |)1 73( |)1 118( |)1 67(| |)1 141 45 1478 6704 t cleartomark showpage saveobj restore %%EndPage: 25 27 %%Page: 26 28 /saveobj save def mark 28 pagesetup 10 R f (- 26 -)2 216 1 2952 480 t ( name as its marker; to reduce overprinting the graph is ``jit-)11 2481(The next one-dimensional graph uses the state's)6 1949 2 970 840 t (tered'' by using a random number as a)7 1538 1 720 960 t 10 I f (y)2283 960 w 10 R f (-value.)2327 960 w 9 CW f (frame invis ht 1 wid 5 bottom solid)7 1890 1 1080 1130 t (label bot "Populations \(in Millions\) of the 50 States")8 2916 1 1080 1240 t (coord x .3,30 y 0,1000 log x)6 1512 1 1080 1350 t (ticks bot out at .5, 1, 2, 5, 10, 20)9 1944 1 1080 1460 t (ticks left off)2 756 1 1080 1570 t (copy "states.d" thru { "$1" size -4 at \($3/1e6,100+900*rand\(\)\) })9 3456 1 1080 1680 t 10 R f (The function)1 513 1 720 1860 t 10 CW f (rand\(\))1258 1860 w 10 R f (returns a pseudo-random real number chosen uniformly over the interval [0,1\).)10 3143 1 1643 1860 t 4860 2776 1260 2776 Dl (Populations \(in Millions\) of the 50 States)6 1651 1 2235 3096 t 1659 2848 1659 2776 Dl (0.5)1597 2958 w 2201 2848 2201 2776 Dl (1)2176 2958 w 2743 2848 2743 2776 Dl (2)2718 2958 w 3459 2848 3459 2776 Dl (5)3434 2958 w 4001 2848 4001 2776 Dl (10)3951 2958 w 4543 2848 4543 2776 Dl (20)4493 2958 w 6 R f (AK)1445 2155 w (WY)1560 2682 w (VT)1636 2215 w (DE)1754 2146 w (ND)1824 2678 w (SD)1874 2522 w (MT)1968 2720 w (NV)1984 2443 w (NH)2093 2715 w (ID)2125 2567 w (RI)2128 2108 w (HI)2141 2612 w (ME)2248 2722 w (NM)2359 2427 w (UT)2457 2351 w (NE)2513 2425 w (WV)2674 2500 w (AR)2806 2152 w (KS)2835 2386 w (MS)2880 2490 w (OR)2916 2495 w (AZ)2942 2454 w (CO)2989 2599 w (IA)3005 2382 w (OK)3023 2209 w (CT)3049 2486 w (SC)3053 2297 w (KY)3172 2630 w (AL)3223 2270 w (MN)3251 2207 w (WA)3261 2190 w (LA)3284 2573 w (MD)3278 2331 w (TN)3352 2695 w (WI)3374 2283 w (MO)3397 2499 w (VA)3468 2339 w (GA)3485 2101 w (IN)3501 2425 w (MA NC)1 110 1 3518 2157 t (NJ)3729 2472 w (MI)3905 2512 w (FL)3945 2646 w (OH)4018 2711 w (IL)4077 2351 w (PA)4096 2603 w (TX)4236 2625 w (NY)4397 2494 w (CA)4633 2318 w 10 R f ( cluttered; circles would have been a better choice as a plotting symbol \(bullets, once again, would)16 3996(This graph is too)3 684 2 720 3334 t (hide data\).)1 421 1 720 3454 t ( \256rst step in)3 482( Our)1 209( form.)1 248(Histograms are a standard way of presenting one-dimensional data in two-dimensional)10 3491 4 970 3610 t ( data is the following)4 848(building a histogram of the population)5 1546 2 720 3730 t 10 I f (awk)3140 3730 w 10 R f (program, which counts how many states are in each)8 2073 1 3327 3730 t (``bin'' of a million people.)4 1068 1 720 3850 t 9 CW f (awk ')1 270 1 1080 4020 t ( bin zero start; bin width)5 1404( #)1 162( bzs=0; bw=1e6 })3 864(BEGIN {)1 486 4 1080 4130 t ({ count[int\(\($3-bzs\)/bw\)]++ })2 1566 1 1512 4240 t ( for \(i in count\) print i, count[i] })8 1998(END {)1 486 2 1080 4350 t (' states2.d)5 1728 1 1080 4460 t 10 R f (The variable)1 501 1 720 4640 t 10 CW f (bzs)1246 4640 w 10 R f (tells where bin zero starts; although it is zero in this graph, it might be 95 in a histogram of human)20 3948 1 1452 4640 t ( program produces the following output in)6 1693( The)1 205(body temperatures in degrees Fahrenheit.)4 1649 3 720 4760 t 10 CW f (states2.d)4292 4760 w 10 R f (:)4832 4760 w 9 CW f (0 12)1 216 1 1080 4930 t (1 5)1 162 1 1080 5040 t (2 7)1 162 1 1080 5150 t (3 5)1 162 1 1080 5260 t (4 7)1 162 1 1080 5370 t (...)1080 5480 w (23 1)1 216 1 1080 5590 t 10 R f ( and)1 193(There are 12 states with population between 0 and 999,999, 5 states with population between 1,000,000)15 4487 2 720 5770 t (1,999,999, and so on.)3 858 1 720 5890 t (This)970 6046 w 10 I f (grap)1173 6046 w 10 R f (program uses three)2 759 1 1387 6046 t 10 CW f (line)2171 6046 w 10 R f (commands to plot each rectangle in the histogram.)7 2014 1 2436 6046 t cleartomark showpage saveobj restore %%EndPage: 26 28 %%Page: 27 29 /saveobj save def mark 29 pagesetup 10 R f (- 27 -)2 216 1 2952 480 t 9 CW f (frame invis bot solid)3 1134 1 1080 890 t (label bot "Populations \(in Millions\) of the 50 States")8 2916 1 1080 1000 t (label left "Number" "of" "States" left .3)6 2214 1 1080 1110 t (ticks bot out from 0 to 25 by 5)8 1674 1 1080 1220 t (coord x 0, 25 y 0, 13)6 1134 1 1080 1330 t (copy "states2.d" thru {)3 1242 1 1080 1440 t (line from $1, 0 to $1, $2)6 1350 1 1512 1550 t (line from $1, $2 to $1+1, $2)6 1512 1 1512 1660 t (line from $1+1, $2 to $1+1 , 0)7 1620 1 1512 1770 t (})1080 1880 w 10 R f (It produces)1 446 1 720 2060 t 4464 3662 2304 3662 Dl 2232 3662 2304 3662 Dl (0)2157 3682 w 2232 3108 2304 3108 Dl (5)2157 3128 w 2232 2554 2304 2554 Dl (10)2107 2574 w (Populations \(in Millions\) of the 50 States)6 1651 1 2559 3982 t (Number)1637 2842 w (of)1759 2962 w (States)1681 3082 w 2304 3734 2304 3662 Dl (0)2279 3844 w 2736 3734 2736 3662 Dl (5)2711 3844 w 3168 3734 3168 3662 Dl (10)3118 3844 w 3600 3734 3600 3662 Dl (15)3550 3844 w 4032 3734 4032 3662 Dl (20)3982 3844 w 4464 3734 4464 3662 Dl (25)4414 3844 w 2304 2333 2304 3662 Dl 2390 2332 2304 2332 Dl 2390 3661 2390 2332 Dl 2390 3109 2390 3662 Dl 2476 3108 2390 3108 Dl 2476 3661 2476 3108 Dl 2476 2887 2476 3662 Dl 2562 2886 2476 2886 Dl 2563 3661 2563 2886 Dl 2563 3109 2563 3662 Dl 2649 3108 2563 3108 Dl 2649 3661 2649 3108 Dl 2649 2887 2649 3662 Dl 2735 2886 2649 2886 Dl 2736 3661 2736 2886 Dl 2736 3109 2736 3662 Dl 2822 3108 2736 3108 Dl 2822 3661 2822 3108 Dl 2908 3552 2908 3662 Dl 2994 3551 2908 3551 Dl 2995 3661 2995 3551 Dl 3081 3441 3081 3662 Dl 3167 3440 3081 3440 Dl 3168 3661 3168 3440 Dl 3168 3552 3168 3662 Dl 3254 3551 3168 3551 Dl 3254 3661 3254 3551 Dl 3254 3441 3254 3662 Dl 3340 3440 3254 3440 Dl 3340 3661 3340 3440 Dl 3513 3552 3513 3662 Dl 3599 3551 3513 3551 Dl 3600 3661 3600 3551 Dl 3772 3552 3772 3662 Dl 3858 3551 3772 3551 Dl 3859 3661 3859 3551 Dl 4291 3552 4291 3662 Dl 4377 3551 4291 3551 Dl 4377 3661 4377 3551 Dl (The same \256le can be plotted in a more attractive \(and more useful\) form by)14 2999 1 970 4256 t 9 CW f (frame invis bot solid left solid)5 1728 1 1080 4426 t (label bot "Populations \(in Millions\) of the 50 States")8 2916 1 1080 4536 t (label left "Number" "of" "States" left .3)6 2214 1 1080 4646 t (ticks bot out from 0 to 25 by 5)8 1674 1 1080 4756 t (coord x 0, 25 y 0, 13)6 1134 1 1080 4866 t (copy "states2.d" thru {)3 1242 1 1080 4976 t (line dotted from $1+.5, 0 to $1+.5, $2)7 2052 1 1512 5086 t ("\\\(bu" size +3 at $1+.5, $2)5 1458 1 1512 5196 t (})1080 5306 w 10 R f (which produces one of Bill Cleveland's ``dot charts'' or ``lolliplots'':)9 2782 1 720 5486 t cleartomark showpage saveobj restore %%EndPage: 27 29 %%Page: 28 30 /saveobj save def mark 30 pagesetup 10 R f (- 28 -)2 216 1 2952 480 t 4464 2280 2304 2280 Dl 2304 840 2304 2280 Dl 2232 2280 2304 2280 Dl (0)2157 2300 w 2232 1726 2304 1726 Dl (5)2157 1746 w 2232 1172 2304 1172 Dl (10)2107 1192 w (Populations \(in Millions\) of the 50 States)6 1651 1 2559 2600 t (Number)1637 1460 w (of)1759 1580 w (States)1681 1700 w 2304 2352 2304 2280 Dl (0)2279 2462 w 2736 2352 2736 2280 Dl (5)2711 2462 w 3168 2352 3168 2280 Dl (10)3118 2462 w 3600 2352 3600 2280 Dl (15)3550 2462 w 4032 2352 4032 2280 Dl (20)3982 2462 w 4464 2352 4464 2280 Dl (25)4414 2462 w 7 R f (.)2337 2283 w (.)2337 2247 w (.)2337 2211 w (.)2337 2175 w (.)2337 2139 w (.)2337 2103 w (.)2337 2067 w (.)2337 2031 w (.)2337 1995 w (.)2337 1959 w (.)2337 1923 w (.)2337 1887 w (.)2337 1851 w (.)2337 1815 w (.)2337 1779 w (.)2337 1744 w (.)2337 1708 w (.)2337 1672 w (.)2337 1636 w (.)2337 1600 w (.)2337 1564 w (.)2337 1528 w (.)2337 1492 w (.)2337 1456 w (.)2337 1420 w (.)2337 1385 w (.)2337 1349 w (.)2337 1313 w (.)2337 1277 w (.)2337 1241 w (.)2337 1205 w (.)2337 1169 w (.)2337 1133 w (.)2337 1097 w (.)2337 1061 w (.)2337 1025 w (.)2337 989 w (.)2337 953 w 13 S f (\267)2317 970 w 7 R f (.)2423 2283 w (.)2423 2246 w (.)2423 2208 w (.)2423 2172 w (.)2423 2135 w (.)2423 2098 w (.)2423 2061 w (.)2423 2024 w (.)2423 1987 w (.)2423 1950 w (.)2423 1913 w (.)2423 1876 w (.)2423 1840 w (.)2423 1802 w (.)2423 1766 w (.)2423 1729 w 13 S f (\267)2403 1746 w 7 R f (.)2510 2283 w (.)2510 2247 w (.)2510 2212 w (.)2510 2177 w (.)2510 2141 w (.)2510 2106 w (.)2510 2071 w (.)2510 2036 w (.)2510 2000 w (.)2510 1965 w (.)2510 1930 w (.)2510 1895 w (.)2510 1860 w (.)2510 1825 w (.)2510 1789 w (.)2510 1754 w (.)2510 1719 w (.)2510 1683 w (.)2510 1648 w (.)2510 1613 w (.)2510 1578 w (.)2510 1542 w (.)2510 1507 w 13 S f (\267)2490 1524 w 7 R f (.)2596 2283 w (.)2596 2246 w (.)2596 2208 w (.)2596 2172 w (.)2596 2135 w (.)2596 2098 w (.)2596 2061 w (.)2596 2024 w (.)2596 1987 w (.)2596 1950 w (.)2596 1913 w (.)2596 1876 w (.)2596 1840 w (.)2596 1802 w (.)2596 1766 w (.)2596 1729 w 13 S f (\267)2576 1746 w 7 R f (.)2682 2283 w (.)2682 2247 w (.)2682 2212 w (.)2682 2177 w (.)2682 2141 w (.)2682 2106 w (.)2682 2071 w (.)2682 2036 w (.)2682 2000 w (.)2682 1965 w (.)2682 1930 w (.)2682 1895 w (.)2682 1860 w (.)2682 1825 w (.)2682 1789 w (.)2682 1754 w (.)2682 1719 w (.)2682 1683 w (.)2682 1648 w (.)2682 1613 w (.)2682 1578 w (.)2682 1542 w (.)2682 1507 w 13 S f (\267)2662 1524 w 7 R f (.)2769 2283 w (.)2769 2246 w (.)2769 2208 w (.)2769 2172 w (.)2769 2135 w (.)2769 2098 w (.)2769 2061 w (.)2769 2024 w (.)2769 1987 w (.)2769 1950 w (.)2769 1913 w (.)2769 1876 w (.)2769 1840 w (.)2769 1802 w (.)2769 1766 w (.)2769 1729 w 13 S f (\267)2749 1746 w 7 R f (.)2942 2283 w (.)2942 2246 w (.)2942 2208 w (.)2942 2172 w 13 S f (\267)2922 2189 w 7 R f (.)3114 2283 w (.)3114 2246 w (.)3114 2208 w (.)3114 2172 w (.)3114 2135 w (.)3114 2098 w (.)3114 2061 w 13 S f (\267)3094 2078 w 7 R f (.)3201 2283 w (.)3201 2246 w (.)3201 2208 w (.)3201 2172 w 13 S f (\267)3181 2189 w 7 R f (.)3287 2283 w (.)3287 2246 w (.)3287 2208 w (.)3287 2172 w (.)3287 2135 w (.)3287 2098 w (.)3287 2061 w 13 S f (\267)3267 2078 w 7 R f (.)3546 2283 w (.)3546 2246 w (.)3546 2208 w (.)3546 2172 w 13 S f (\267)3526 2189 w 7 R f (.)3806 2283 w (.)3806 2246 w (.)3806 2208 w (.)3806 2172 w 13 S f (\267)3786 2189 w 7 R f (.)4324 2283 w (.)4324 2246 w (.)4324 2208 w (.)4324 2172 w 13 S f (\267)4304 2189 w 10 R f (\(We use)1 329 1 720 2838 t 10 CW f (\\\(bu)1074 2838 w 10 R f (, the)1 172 1 1314 2838 t 10 I f (troff)1511 2838 w 10 R f (character for a bullet, rather than the built-in string to get a larger size.\))13 2840 1 1709 2838 t ( following)1 414( The)1 205(Other histograms are possible.)3 1215 3 970 2994 t 10 I f (awk)2829 2994 w 10 R f (program)3015 2994 w 9 CW f (awk ')1 270 1 1080 3164 t ( bin zero start; bin width)5 1404( #)1 162( bzs=0; bw=1e6 })3 864(BEGIN {)1 486 4 1080 3274 t ({ thisbin=int\(\($3-bzs\)/bw\); print $1, thisbin, count[thisbin]++ })6 3510 1 1512 3384 t (' states3.d)2 1188 1 1080 3494 t 10 R f (produces the \256le)2 660 1 720 3674 t 10 CW f (states3.d)1405 3674 w 9 CW f (AK 0 0)2 324 1 1080 3844 t (WY 0 1)2 324 1 1080 3954 t (VT 0 2)2 324 1 1080 4064 t (DE 0 3)2 324 1 1080 4174 t (ND 0 4)2 324 1 1080 4284 t (...)1080 4394 w (CA 23 0)2 378 1 1080 4504 t 10 R f ( The)1 205(which lists the state's abbreviation, bin number, and height within the bin.)11 2965 2 720 4684 t 10 I f (grap)3915 4684 w 10 R f (program)4129 4684 w 9 CW f (frame invis wid 4 ht 2.5 bot solid)7 1836 1 1080 4854 t (ticks bot out from 0 to 25 by 5)8 1674 1 1080 4964 t (ticks left off)2 756 1 1080 5074 t (label bot "Populations \(in Millions\) of the 50 States")8 2916 1 1080 5184 t (coord x 0,25 y 0,13)4 1026 1 1080 5294 t (copy "states3.d" thru { "$1" size -4 at $2+.5, $3+.5 })10 2916 1 1080 5404 t 10 R f ( which the state names are used to display the heights of the bins.)13 2660(reads that \256le to make the following histogram, in)8 2020 2 720 5584 t (In each bin, the states occur in increasing order of population from bottom to top.)14 3251 1 720 5704 t cleartomark showpage saveobj restore %%EndPage: 28 30 %%Page: 29 31 /saveobj save def mark 31 pagesetup 10 R f (- 29 -)2 216 1 2952 480 t 4500 2640 1620 2640 Dl 1620 2712 1620 2640 Dl (0)1595 2822 w 2196 2712 2196 2640 Dl (5)2171 2822 w 2772 2712 2772 2640 Dl (10)2722 2822 w 3348 2712 3348 2640 Dl (15)3298 2822 w 3924 2712 3924 2640 Dl (20)3874 2822 w 4500 2712 4500 2640 Dl (25)4450 2822 w (Populations \(in Millions\) of the 50 States)6 1651 1 2235 2960 t 6 R f (AK)1634 2590 w (WY)1628 2452 w (VT)1637 2313 w (DE)1637 2175 w (ND)1634 2037 w (SD)1639 1898 w (MT)1632 1760 w (NV)1634 1621 w (NH)1634 1482 w (ID)1646 1344 w (RI)1647 1206 w (HI)1646 1067 w (ME)1747 2590 w (NM)1744 2452 w (UT)1752 2313 w (NE)1752 2175 w (WV)1743 2037 w (AR)1867 2590 w (KS)1870 2452 w (MS)1865 2313 w (OR)1867 2175 w (AZ)1868 2037 w (CO)1867 1898 w (IA)1877 1760 w (OK)1980 2590 w (CT)1985 2452 w (SC)1986 2313 w (KY)1980 2175 w (AL)1983 2037 w (MN)2090 2590 w (WA)2089 2452 w (LA)2098 2313 w (MD)2090 2175 w (TN)2098 2037 w (WI)2100 1898 w (MO)2090 1760 w (VA)2210 2590 w (GA)2210 2452 w (IN)2222 2313 w (MA)2205 2175 w (NC)2212 2037 w (NJ MI)1 300 1 2451 2590 t (FL)2679 2452 w (OH IL)1 187 1 2786 2590 t (PA)2906 2452 w ( CA)1 690(TX NY)1 429 2 3250 2590 t 10 R f ( version of)2 437(The next data set is a run-time pro\256le of an early)10 1986 2 970 3234 t 10 I f (grap)3423 3234 w 10 R f (, created by compiling the program with the)7 1788 1 3612 3234 t 10 CW f (-p)720 3354 w 10 R f (option and running)2 761 1 865 3354 t 10 CW f (prof)1651 3354 w 10 R f (after the program executed.)3 1096 1 1916 3354 t 9 CW f (%time cumsecs #call ms/call name)4 1944 1 1134 3524 t ( _yylook)1 486( 0.41)1 486( 26834)1 378(21.1 11.02)1 702 4 1188 3634 t ( _yyparse)1 540( 195.60)1 486( 30)1 378(11.2 16.89)1 702 4 1188 3744 t ( __doprnt)1 1404(9.3 21.75)1 648 2 1242 3854 t ( _write)1 1296(9.1 26.52)1 648 2 1242 3964 t (...)1080 4074 w ( _tickside)1 594( 0.00)1 486(0.0 52.19 170)2 1026 3 1242 4184 t 10 R f ( in the program, the top four time-hogs accounted for more than half)12 2767(Although there were more than \256fty procedures)6 1913 2 720 4364 t ( \256le is dif\256cult for)4 732( This)1 229(of the run time.)3 619 3 720 4484 t 10 I f (grap)2326 4484 w 10 R f ( even though)2 516(to deal with:)2 502 2 2541 4484 t 10 CW f (if)3584 4484 w 10 R f (statements would allow us to extract lines)6 1671 1 3729 4484 t (2 through 11 of the \256le, we could not remove the leading)11 2319 1 720 4604 t 10 CW f (_)3068 4604 w 10 R f ( routine name or access the last \256eld in a record.)10 1976(from a)1 267 2 3157 4604 t (We will therefore process it with the following)7 1872 1 720 4724 t 10 I f (awk)2617 4724 w 10 R f (program.)2803 4724 w 9 CW f (awk ')1 270 1 1080 4894 t (NR==2, NR==11 { print $1, substr\($NF,2\) })6 2214 1 1080 5004 t (' prof2.d)2 1026 1 1080 5114 t 10 R f (The program produces)2 903 1 720 5294 t 9 CW f (21.1 yylook)1 594 1 1080 5464 t (11.2 yyparse)1 648 1 1080 5574 t (9.3 _doprnt)1 594 1 1080 5684 t (9.1 write)1 486 1 1080 5794 t (5.9 input)1 486 1 1080 5904 t (...)1080 6014 w (2.0 nextchar)1 648 1 1080 6124 t 10 R f ( use the)2 329(We could even)2 620 2 720 6304 t 10 I f (sh)1706 6304 w 10 R f (statement to execute the)3 998 1 1832 6304 t 10 I f (awk)2867 6304 w 10 R f (program from within)2 862 1 3065 6304 t 10 I f (grap)3964 6304 w 10 R f (, which would make the latter)5 1247 1 4153 6304 t (entirely self-contained \(see the reference manual for details\).)7 2425 1 720 6424 t (We will display the data with this program.)7 1732 1 970 6580 t cleartomark showpage saveobj restore %%EndPage: 29 31 %%Page: 30 32 /saveobj save def mark 32 pagesetup 10 R f (- 30 -)2 216 1 2952 480 t 9 CW f (ticks left off)2 756 1 1080 890 t (cury = 0)2 432 1 1080 1000 t (barht = .7)2 540 1 1080 1110 t (copy "prof2.d" thru {)3 1134 1 1080 1220 t (line from 0, cury to $1, cury)6 1566 1 1512 1330 t (line from $1, cury to $1, cury-barht)6 1944 1 1512 1440 t (line from 0, cury-barht to $1, cury-barht)6 2214 1 1512 1550 t ( ljust at 0, cury-barht/2)4 1350(" $2")1 324 2 1512 1660 t (cury = cury-1)2 702 1 1512 1770 t (})1080 1880 w (line from 0, 0 to 0, cury+1-barht)6 1782 1 1080 1990 t (bars = -cury)2 648 1 1080 2100 t (frame invis ht bars/3 wid 3)5 1458 1 1080 2210 t 10 R f ( uses default ticks and a)5 991( It)1 118(Observe that the program knows nothing about the range of the data.)11 2822 3 720 2390 t 10 CW f (frame)4684 2390 w 10 R f (statement)5017 2390 w (with a computed height to achieve total data independence.)8 2365 1 720 2510 t 2112 5143 2112 5071 Dl (0)2087 5253 w 2561 5143 2561 5071 Dl (5)2536 5253 w 3010 5143 3010 5071 Dl (10)2960 5253 w 3459 5143 3459 5071 Dl (15)3409 5253 w 3908 5143 3908 5071 Dl (20)3858 5253 w 4007 2819 2112 2819 Dl 4007 2970 4007 2819 Dl 4007 2971 2112 2971 Dl (yylook)2162 2915 w 3117 3036 2112 3036 Dl 3118 3187 3118 3036 Dl 3117 3188 2112 3188 Dl (yyparse)2162 3132 w 2947 3253 2112 3253 Dl 2947 3404 2947 3253 Dl 2947 3405 2112 3405 Dl 10 S f (_)2162 3349 w 10 R f (doprnt)2212 3349 w 2929 3470 2112 3470 Dl 2929 3621 2929 3470 Dl 2929 3622 2112 3622 Dl (write)2162 3566 w 2641 3687 2112 3687 Dl 2642 3838 2642 3687 Dl 2641 3839 2112 3839 Dl (input)2162 3783 w 2641 3904 2112 3904 Dl 2642 4055 2642 3904 Dl 2641 4056 2112 4056 Dl (print)2162 4000 w 2623 4121 2112 4121 Dl 2624 4272 2624 4121 Dl 2623 4273 2112 4273 Dl (sprintf)2162 4217 w 2471 4338 2112 4338 Dl 2471 4489 2471 4338 Dl 2471 4490 2112 4490 Dl (unput)2162 4434 w 2471 4555 2112 4555 Dl 2471 4706 2471 4555 Dl 2471 4707 2112 4707 Dl (yylex)2162 4651 w 2291 4772 2112 4772 Dl 2292 4923 2292 4772 Dl 2291 4924 2112 4924 Dl (nextchar)2162 4868 w 2112 4924 2112 2819 Dl (This bar chart highlights the fact that most of the time spent by)12 2515 1 720 5521 t 10 I f (grap)3260 5521 w 10 R f (is devoted to input and output.)5 1217 1 3474 5521 t ( of a one-dimensional distri-)4 1136(J. W. Tukey's box and whisker plots represent the median, quartiles, and extremes)12 3294 2 970 5677 t ( following)1 423(bution. The)1 495 2 720 5797 t 10 I f (grap)1672 5797 w 10 R f ( to draw a box plot, and then uses that shape to compare the)13 2489(program de\256nes a macro)3 1016 2 1895 5797 t (distribution of heights of volcanoes with the distribution of heights of States of the Union.)14 3602 1 720 5917 t cleartomark showpage saveobj restore %%EndPage: 30 32 %%Page: 31 33 /saveobj save def mark 33 pagesetup 10 R f (- 31 -)2 216 1 2952 480 t 9 CW f (frame invis ht 4 wid 3 bot solid)7 1728 1 1080 890 t (ticks off)1 486 1 1080 1000 t (coord x .5,3.5 y 0,25)4 1134 1 1080 1110 t (define Ht { "- $1,000 -" size -3 at 2,$1 })10 2268 1 1080 1220 t (Ht\(5\); Ht\(10\); Ht\(15\); Ht\(20\))3 1566 1 1080 1330 t ("Highest Point" "in 50 States" at 1,23)6 2052 1 1080 1440 t ("Heights of" "219 Volcanoes" at 3,23)5 1944 1 1080 1550 t ("Feet" at 2,21.5; arrow from 2,22.5 to 2,24)7 2322 1 1080 1660 t (define box { #\(x, min, 25%, median, 75%, max, minname, maxname\))10 3402 1 1080 1770 t (xc = $1; xl = xc-boxwidth/2; xh = xc+boxwidth/2)8 2538 1 1512 1880 t (y1 = $2; y2 = $3; y3 = $4; y4 = $5; y5 = $6)14 2322 1 1512 1990 t (bullet at xc,y1)2 810 1 1512 2100 t ( size -3 ljust at \(xc,y1\))5 1350(" $7")1 324 2 1512 2210 t ( lo whisker)2 594( #)1 162(line from \(xc,y1\) to \(xc,y2\))4 1512 3 1512 2320 t ( box bot)2 432( #)1 162(line from \(xl,y2\) to \(xh,y2\))4 1512 3 1512 2430 t ( box mid)2 432( #)1 162(line from \(xl,y3\) to \(xh,y3\))4 1512 3 1512 2540 t ( box top)2 432( #)1 162(line from \(xl,y4\) to \(xh,y4\))4 1512 3 1512 2650 t ( box left)2 486( #)1 162(line from \(xl,y2\) to \(xl,y4\))4 1512 3 1512 2760 t ( box right)2 540( #)1 162(line from \(xh,y2\) to \(xh,y4\))4 1512 3 1512 2870 t ( hi whisker)2 594( #)1 162(line from \(xc,y4\) to \(xc,y5\))4 1512 3 1512 2980 t (bullet at xc,y5)2 810 1 1512 3090 t ( size -3 ljust at \(xc,y5\))5 1350(" $8")1 324 2 1512 3200 t (})1080 3310 w (boxwidth = .3)2 702 1 1080 3420 t (box\(1, .3, 2.0, 4.6, 11.2, 20.3, Florida, Alaska\))7 2646 1 1080 3530 t ( 19.9, Ilhanova, Guallatiri\))3 1512( 9.5,)1 324(box\(3, .2, 3.7, 6.5,)3 1080 3 1080 3640 t 10 R f ( you use such shapes fre-)5 1005( If)1 117( of many shapes used for the graphical representation of several quantities.)11 2993(Boxes are one)2 565 4 720 3820 t ( macros to)2 426(quently then you should make a library \256le of their)9 2088 2 720 3940 t 10 CW f (copy)3264 3940 w 10 R f (into your)1 369 1 3534 3940 t 10 I f (grap)3933 3940 w 10 R f ( above program)2 636(programs. The)1 612 2 4152 3940 t (produces)720 4060 w 4140 7102 1980 7102 Dl 7 R f (- 5,000 -)2 240 1 2940 6546 t (- 10,000 -)2 275 1 2923 5970 t (- 15,000 -)2 275 1 2923 5394 t (- 20,000 -)2 275 1 2923 4818 t 10 R f (Highest Point)1 548 1 2066 4412 t (in 50 States)2 467 1 2107 4532 t (Heights of)1 419 1 3571 4412 t (219 Volcanoes)1 596 1 3482 4532 t (Feet)2974 4645 w 3060 4338 3060 4510 Dl 3060 4337 3078 4409 Dl 3060 4337 3042 4409 Dl 10 S f (\267)2317 7096 w 7 R f (Florida)2394 7087 w 10 R f 2340 6872 2340 7067 Dl 2448 6871 2232 6871 Dl 2448 6572 2232 6572 Dl 2448 5811 2232 5811 Dl 2232 5812 2232 6871 Dl 2448 5812 2448 6871 Dl 2340 4763 2340 5811 Dl 10 S f (\267)2317 4792 w 7 R f (Alaska)2394 4783 w 10 S f (\267)3757 7107 w 7 R f (Ilhanova)3834 7098 w 10 R f 3780 6675 3780 7078 Dl 3888 6675 3672 6675 Dl 3888 6353 3672 6353 Dl 3888 6007 3672 6007 Dl 3672 6007 3672 6675 Dl 3888 6007 3888 6675 Dl 3780 4809 3780 6007 Dl 10 S f (\267)3757 4838 w 7 R f (Guallatiri)3834 4829 w 10 R f (Even though the extreme heights are the same, state heights have a lower median and a greater spread.)17 4087 1 720 7300 t cleartomark showpage saveobj restore %%EndPage: 31 33 %%Page: 32 34 /saveobj save def mark 34 pagesetup 10 R f (- 32 -)2 216 1 2952 480 t (Someday you may use)3 935 1 970 840 t 10 I f (grap)1941 840 w 10 R f ( out too)2 330(to prepare overhead transparencies, only to \256nd that everything comes)9 2904 2 2166 840 t ( following program illustrates some ways to get larger graphs.)9 2480(small. The)1 447 2 720 960 t 9 CW f (.ps 14)1 324 1 1080 1130 t (.vs 18)1 324 1 1080 1240 t (.G1 4)1 270 1 1080 1350 t (frame ht 2 wid 2)4 864 1 1080 1460 t (label left "Response" "Variable" left .5)5 2160 1 1080 1570 t (label bot "Factor Variable")3 1458 1 1080 1680 t (line from 0,0 to 1,1)4 1080 1 1080 1790 t (line dotted from .5,0 to .5,1)5 1566 1 1080 1900 t (define blob X "\\v'.1m'\\\(bu\\v'-.1m'" X)4 1998 1 1080 2010 t (blob at 0,.5; blob at .5,.5; blob at 1,.5)8 2214 1 1080 2120 t (.G2)1080 2230 w (.ps)1080 2340 w (.vs)1080 2450 w 10 R f (The)720 2630 w 10 CW f (ps)900 2630 w 10 R f (and)1045 2630 w 10 CW f (vs)1214 2630 w 10 R f ( size to 14 points and the vertical spacing to 18 points; the)12 2333(commands preceding the graph set the text)6 1708 2 1359 2630 t ( the)1 154(two quantities are reset by the commands following)7 2123 2 720 2750 t 10 CW f (.G2)3029 2750 w 10 R f ( size changes should be made outside the)7 1688(. Such)1 282 2 3209 2750 t 10 I f (grap)5211 2750 w 10 R f ( The)1 223(program, as mentioned earlier.)3 1276 2 720 2870 t 10 CW f (4)2262 2870 w 10 R f (following the)1 554 1 2365 2870 t 10 CW f (.G1)2962 2870 w 10 R f ( graph \(including)2 726(stretches the)1 514 2 3185 2870 t 10 I f (grap)4469 2870 w 10 R f ('s estimate of the)3 742 1 4658 2870 t ( an alternative to altering the)5 1150(accompanying text\) to be four inches wide; it is)8 1919 2 720 2990 t 10 CW f (frame)3815 2990 w 10 R f ( macro)1 275(command. The)1 625 2 4141 2990 t 10 CW f (blob)5067 2990 w 10 R f (is)5333 2990 w (a plotting symbol that is much larger than)7 1697 1 720 3110 t 10 CW f (bullet)2446 3110 w 10 R f (; the different name ensures that later references to)8 2053 1 2806 3110 t 10 CW f (bullet)4889 3110 w 10 R f (are)5279 3110 w (unaffected. The)1 658 1 720 3230 t 10 I f (troff)1411 3230 w 10 R f (commands within the)2 877 1 1617 3230 t 10 CW f (blob)2526 3230 w 10 R f (string move the character down one-tenth of an em to center its)11 2602 1 2798 3230 t ( program produces this trivial)4 1198( The)1 208(plotting position \(determined experimentally\) and then reset the vertical position.)9 3274 3 720 3350 t (\(but large\) graph.)2 695 1 720 3470 t 14 R f 2718 3713 2718 5494 Dl 4499 3713 2718 3713 Dl 4500 5494 4500 3713 Dl 2719 5494 4500 5494 Dl 2828 5583 2828 5494 Dl (0)2793 5723 w 3609 5583 3609 5494 Dl (0.5)3522 5723 w 4390 5583 4390 5494 Dl (1)4355 5723 w 2629 5384 2718 5384 Dl (0)2524 5412 w 2629 4603 2718 4603 Dl (0.5)2419 4631 w 2629 3822 2718 3822 Dl (1)2524 3850 w (Response)1588 4541 w (Variable)1617 4721 w (Factor Variable)1 873 1 3173 5893 t 4390 3822 2828 5384 Dl 11 R f (.)3595 5388 w (.)3595 5344 w (.)3595 5299 w (.)3595 5254 w (.)3595 5210 w (.)3595 5165 w (.)3595 5121 w (.)3595 5076 w (.)3595 5031 w (.)3595 4987 w (.)3595 4942 w (.)3595 4897 w (.)3595 4853 w (.)3595 4808 w (.)3595 4763 w (.)3595 4719 w (.)3595 4674 w (.)3595 4629 w (.)3595 4585 w (.)3595 4540 w (.)3595 4496 w (.)3595 4451 w (.)3595 4406 w (.)3595 4362 w (.)3595 4317 w (.)3595 4272 w (.)3595 4228 w (.)3595 4183 w (.)3595 4138 w (.)3595 4094 w (.)3595 4049 w (.)3595 4005 w (.)3595 3960 w (.)3595 3915 w (.)3595 3871 w (.)3595 3826 w 14 S f (\267 \267 \267)2 1626 1 2796 4645 t 10 B f ( Grap)1 253(4. Using)1 370 2 720 6296 t 10 R f (Following are a few day-to-day matters about using)7 2066 1 970 6452 t 10 I f (grap)3061 6452 w 10 R f (.)3250 6452 w 10 B f (4.1. Errors)1 488 1 720 6692 t 10 I f (Grap)970 6848 w 10 R f (attempts to pinpoint input errors; for example, the input)8 2224 1 1206 6848 t 9 CW f (.G1)1080 7018 w (i = i + 1)4 486 1 1080 7128 t 10 R f (results in this message on)4 1022 1 720 7308 t 10 CW f (stderr)1767 7308 w 10 R f (:)2127 7308 w cleartomark showpage saveobj restore %%EndPage: 32 34 %%Page: 33 35 /saveobj save def mark 35 pagesetup 10 R f (- 33 -)2 216 1 2952 480 t 9 CW f (grap: syntax error near line 1, file -)7 2052 1 1080 890 t (context is)1 540 1 1134 1000 t ( 1)1 162( <<<)1 216( +)1 162(i = i >>>)3 486 4 1512 1110 t 10 R f (The error was noticed at the)5 1156 1 720 1290 t 10 CW f (+)1909 1290 w 10 R f ( pinpointing is not the same as explaining: the real error is that the)13 2762(. Unfortunately,)1 669 2 1969 1290 t (variable)720 1410 w 10 CW f (i)1066 1410 w 10 R f (was not initialized.)2 758 1 1151 1410 t (The ``words'')1 566 1 970 1566 t 10 CW f (x)1571 1566 w 10 R f (and)1666 1566 w 10 CW f (y)1845 1566 w 10 R f (are reserved \(for the)3 834 1 1940 1566 t 10 CW f (coord)2809 1566 w 10 R f ( inexplicable syntax)2 821(statement\); you will get an equally)5 1435 2 3144 1566 t ( bad, but not nearly so bad as having the)9 1645( design is)2 388( \(This)1 266(error message if you use them as variable names.)8 1999 4 720 1686 t 10 CW f (log)5047 1686 w 10 R f (and)5256 1686 w 10 CW f (exp)720 1806 w 10 R f (functions use base 10.\))3 915 1 925 1806 t 10 I f (Grap)970 1962 w 10 R f (tries to load a \256le of standard macro de\256nitions \()9 2215 1 1236 1962 t 10 CW f (/usr/lib/grap.defines)3451 1962 w 10 R f (\) for terms like)3 689 1 4711 1962 t 10 CW f (bullet)720 2082 w 10 R f (,)1080 2082 w 10 CW f (plus)1133 2082 w 10 R f ( later use one of these words, you'll get a)9 1659( doesn't complain if that \256le isn't found, but if you)10 2060( It)1 114(, etc.)1 194 4 1373 2082 t (syntax error message.)2 867 1 720 2202 t (Certain constructs suggested by analogy to)5 1762 1 970 2358 t 10 I f (pic)2767 2358 w 10 R f ( example,)1 399( For)1 200(do not work.)2 530 3 2925 2358 t 10 CW f (.GS)4090 2358 w 10 R f (and)4306 2358 w 10 CW f (.GE)4486 2358 w 10 R f (would have been)2 698 1 4702 2358 t (nicer than)1 396 1 720 2478 t 10 CW f (.G1)1141 2478 w 10 R f (and)1346 2478 w 10 CW f (.G2)1515 2478 w 10 R f ( The)1 205(, but they were already taken.)5 1177 2 1695 2478 t 10 I f (pic)3102 2478 w 10 R f (construct)3249 2478 w 9 CW f (.PS )3506 2912 w 10 R f (,)3566 2912 w 10 CW f (>=)3625 2912 w 10 R f (,)3745 2912 w 10 CW f (<)3804 2912 w 10 R f (,)3864 2912 w 10 CW f (<=)3923 2912 w 10 R f (,)4043 2912 w 10 CW f (!)4102 2912 w 10 R f (,)4162 2912 w 10 CW f (||)4221 2912 w 10 R f (, and)1 203 1 4341 2912 t 10 CW f (&&)4578 2912 w 10 R f ( may be)2 334(. Strings)1 368 2 4698 2912 t (compared with the operators)3 1139 1 720 3032 t 10 CW f (==)1884 3032 w 10 R f (and)2029 3032 w 10 CW f (!=)2198 3032 w 10 R f (.)2318 3032 w (It is possible to convert numeric expressions to formatted strings:)9 2612 1 970 3188 t 9 CW f (sprintf\(")1080 3358 w 9 I f (format)1566 3358 w 9 CW f (",)1806 3358 w 9 I f (expr)1968 3358 w 9 CW f (,)2128 3358 w 9 I f (expr)2236 3358 w 9 CW f (, ...\))1 324 1 2396 3358 t 10 R f ( of)1 108( Variants)1 388(is equivalent to a quoted string in any context.)8 1846 3 720 3538 t 10 CW f (%f)3087 3538 w 10 R f (and)3232 3538 w 10 CW f (%g)3401 3538 w 10 R f (are the only sensible format conversions.)5 1636 1 3546 3538 t 10 I f (Grap)970 3694 w 10 R f (provides the same macro processor that)5 1577 1 1206 3694 t 10 I f (pic)2808 3694 w 10 R f (does:)2955 3694 w 9 CW f (define)1080 3864 w 9 I f (macro-name)1458 3864 w 9 CW f ({)1967 3864 w 9 I f (anything)2075 3864 w 9 CW f (})2444 3864 w 10 R f ( name will be replaced by the string, with arguments of the form)12 2655(Subsequent occurrences of the macro)4 1514 2 720 4044 t 10 CW f ($)4921 4044 w 10 I f (n)4981 4044 w 10 R f (replaced)5063 4044 w ( de\256nitions persist across)3 1008( Macro)1 310(by corresponding actual arguments.)3 1425 3 720 4164 t 10 CW f (.G2)3488 4164 w 10 R f (boundaries, as do values of variables.)5 1494 1 3693 4164 t (The)970 4320 w 10 CW f (copy)1150 4320 w 10 R f (statement is somewhat overloaded:)3 1401 1 1415 4320 t 9 CW f (copy ")1 324 1 1080 4490 t 9 I f (filename)1404 4490 w 9 CW f (")1714 4490 w 10 R f (includes the contents of the named \256le at that point;)9 2068 1 720 4670 t 9 CW f (copy ")1 324 1 1080 4840 t 9 I f (filename)1404 4840 w 9 CW f (" thru)1 324 1 1714 4840 t 9 I f (macro-name)2092 4840 w 10 R f (copies the \256le through the macro; and)6 1509 1 720 5020 t 9 CW f (copy thru)1 486 1 1080 5190 t 9 I f (macro-name)1620 5190 w 10 R f ( each case,)2 446( In)1 142( the macro; each number or quoted string is treated as an argument.)12 2794(copies subsequent lines through)3 1298 4 720 5370 t (copying continues until end of \256le or the next)8 1909 1 720 5490 t 10 CW f (.G2)2665 5490 w 10 R f ( optional clause)2 649(. The)1 241 2 2845 5490 t 10 CW f (until)3771 5490 w 10 I f (str)4107 5490 w 10 R f ( to terminate)2 525(causes copying)1 618 2 4257 5490 t (when a line whose \256rst \256eld is)6 1216 1 720 5610 t 10 I f (str)1961 5610 w 10 R f ( all cases, the macro can be speci\256ed inline rather than by name:)12 2569(occurs. In)1 418 2 2100 5610 t 9 CW f (copy thru {)2 594 1 1080 5780 t 9 I f (macro body)1 428 1 1728 5780 t 9 CW f (})2210 5780 w 10 R f (The)970 5996 w 10 CW f (sh)1150 5996 w 10 R f (command passes text through to the UNIX shell.)7 1948 1 1295 5996 t 9 I f (sh)1080 6166 w 9 CW f (:)1167 6166 w (sh {)1 216 1 1512 6276 t 9 I f (anything)1782 6276 w 9 CW f (})2151 6276 w 10 R f ( built-in macro)2 624( The)1 220( is scanned for macros.)4 977(The body of the command)4 1110 4 720 6456 t 10 CW f (pid)3691 6456 w 10 R f (is a string consisting of the process)6 1489 1 3911 6456 t (identi\256cation number; it can be used to generate unique \256le names.)10 2677 1 720 6576 t (The)970 6732 w 10 CW f (pic)1154 6732 w 10 R f ( through to)2 449(command passes text)2 857 2 1363 6732 t 10 I f (pic)2699 6732 w 10 R f (with the ``)2 426 1 2851 6732 t 10 CW f (pic)3277 6732 w 10 R f ('' removed; variables and macros are not evalu-)7 1943 1 3457 6732 t ( are not numbers\) are passed through literally, under the assumption that)11 2978( beginning with a period \(that)5 1230(ated. Lines)1 472 3 720 6852 t (they are)1 318 1 720 6972 t 10 I f (troff)1063 6972 w 10 R f (commands.)1261 6972 w (The)970 7128 w 10 CW f (graph)1150 7128 w 10 R f (statement)1475 7128 w cleartomark showpage saveobj restore %%EndPage: 36 38 %%Page: 37 39 /saveobj save def mark 39 pagesetup 10 R f (- 37 -)2 216 1 2952 480 t 9 I f (graph)1080 890 w 9 CW f (:)1302 890 w (graph)1512 1000 w 9 I f (Picname \(pic-text\))1 668 1 1836 1000 t 10 R f (de\256nes a new graph named)4 1102 1 720 1180 t 10 I f (Picname)1851 1180 w 10 R f ( any)1 174( If)1 120(, resetting all coordinate systems.)4 1348 3 2200 1180 t 10 CW f (graph)3872 1180 w 10 R f (commands are used in a)4 979 1 4202 1180 t 10 I f (grap)5211 1180 w 10 R f (program, then the statement after the)5 1519 1 720 1300 t 10 CW f (.G1)2274 1300 w 10 R f (must be a)2 403 1 2489 1300 t 10 CW f (graph)2927 1300 w 10 R f (command. The)1 634 1 3262 1300 t 10 I f (pic-text)3931 1300 w 10 R f ( this)1 179(can be used to position)4 956 2 4265 1300 t (graph relative to previous graphs by referring to their)8 2123 1 720 1420 t 10 CW f (Frame)2868 1420 w 10 R f (s, as in)2 275 1 3168 1420 t 9 CW f (graph First)1 594 1 1512 1590 t (...)1566 1700 w (graph Second with .Frame.w at First.Frame.e + \(0.1,0\))7 2862 1 1512 1810 t 10 R f (Macros and expressions in)3 1062 1 720 1990 t 10 I f (pic-text)1807 1990 w 10 R f (are not evaluated.)2 706 1 2131 1990 t 10 I f (Picname)2887 1990 w 10 R f (s must begin with a capital letter to satisfy)8 1688 1 3236 1990 t 10 I f (pic)4949 1990 w 10 R f (syntax.)5096 1990 w (The)970 2146 w 10 CW f (print)1150 2146 w 10 R f (statement)1475 2146 w 9 I f (print)1080 2316 w 9 CW f (:)1262 2316 w (print)1512 2426 w 9 I f (\(expr)1836 2426 w 9 S f (|)2080 2426 w 9 I f (str\))2152 2426 w 10 R f (writes on)1 369 1 720 2606 t 10 CW f (stderr)1114 2606 w 10 R f (as)1499 2606 w 10 I f (grap)1607 2606 w 10 R f (processes its input; it is sometimes useful for debugging.)8 2269 1 1821 2606 t (Many reserved words have synonyms, such as)6 2005 1 970 2762 t 10 CW f (thru)3027 2762 w 10 R f (for)3319 2762 w 10 CW f (through)3487 2762 w 10 R f (,)3907 2762 w 10 CW f (tick)3984 2762 w 10 R f (for)4276 2762 w 10 CW f (ticks,)4444 2762 w 10 R f (and)4856 2762 w 10 CW f (bot)5052 2762 w 10 R f (for)5284 2762 w 10 CW f (bottom)720 2882 w 10 R f (.)1080 2882 w (The)970 3038 w 10 CW f (#)1160 3038 w 10 R f ( may be continued over several)5 1294( Statements)1 499(introduces a comment, which ends at the end of the line.)10 2352 3 1255 3038 t ( statements may appear on a single line sepa-)8 1850( Multiple)1 401( each newline with a backslash character.)6 1683(lines by preceding)2 746 4 720 3158 t (rated by semicolons.)2 834 1 720 3278 t 10 I f (Grap)1609 3278 w 10 R f (ignores any line that is entirely blank, including those processed by)10 2739 1 1850 3278 t 10 CW f (copy thru)1 545 1 4619 3278 t 10 R f (com-)5195 3278 w (mands.)720 3398 w (When)970 3554 w 10 I f (grap)1240 3554 w 10 R f ( de\256nitions from the \256le)4 999(is \256rst executed it reads standard macro)6 1622 2 1461 3554 t 10 CW f (/usr/lib/grap.defines)4115 3554 w 10 R f (.)5375 3554 w (The de\256nitions include)2 922 1 720 3674 t 10 CW f (bullet)1667 3674 w 10 R f (,)2027 3674 w 10 CW f (plus)2077 3674 w 10 R f (,)2317 3674 w 10 CW f (box)2367 3674 w 10 R f (,)2547 3674 w 10 CW f (star)2597 3674 w 10 R f (,)2837 3674 w 10 CW f (dot)2887 3674 w 10 R f (,)3067 3674 w 10 CW f (times)3117 3674 w 10 R f (,)3417 3674 w 10 CW f (htick)3467 3674 w 10 R f (,)3767 3674 w 10 CW f (vtick)3817 3674 w 10 R f (,)4117 3674 w 10 CW f (square)4167 3674 w 10 R f (, and)1 194 1 4527 3674 t 10 CW f (delta)4746 3674 w 10 R f (.)5046 3674 w cleartomark showpage saveobj restore %%EndPage: 37 39 %%Trailer done %%Pages: 39 %%DocumentFonts: Courier Times-Bold Helvetica Times-Italic Times-Roman Times-Roman Symbol