Basic for Linux Software Support: Demo Programm
Showplot demo program 10 !"SHOWPLOT" 20 ! 30 ! Loosely based on demo program SinGridAxes 40 ! 50 ! Demo data from Dave K, who ran 60 ! I/O with Redhat 7.3, TAMS SICL, and 70 ! a compiled c program with printf's to 80 ! a fast instrument. 90 ! 100 INTEGER Colors,Plotting 110 Colors=1 120 ! To plot to file "testplotfile", set plotting to 1 130 Plotting=1 140 GOSUB Graphinit 150 GOSUB Toplabel 160 GOSUB Y_label 170 GOSUB X_label 180 GOSUB Data_area 190 GOSUB Label_ticks 200 GOSUB Fillarrays 210 GOSUB Plot2050 220 GOSUB Plot3010 230 IF Plotting THEN GOSUB Finishplot 240 STOP 250 ! 260 ! All Subroutines Below 270 ! 280 ! 290 Graphinit: !Lay out main screen 300 KEY LABELS OFF 310 GINIT 320 IF Plotting THEN 330 EXECUTE ("touch testplotfile") ! creates file if none exists 340 PLOTTER IS "testplotfile","HPGL" 350 ELSE 360 PLOTTER IS CRT,"INTERNAL" 370 END IF 380 GRAPHICS ON 390 DEG ! Degrees not Radians for LDIR 400 PEN 1 410 X_gdu_max=100*MAX(1,RATIO) ! Width 420 Y_gdu_max=100*MAX(1,1/RATIO) ! Height 430 RETURN 440 ! 450 ! 460 Toplabel: ! Label at top of graph 470 LORG 6 480 MOVE X_gdu_max/2,Y_gdu_max-1 490 LABEL "DEMO 1: HPIB Average Throughput" 500 RETURN 510 ! 520 ! 530 Y_label: !Label Y axis 540 LDIR 90 550 CSIZE 4.5 560 MOVE 3,Y_gdu_max/2 570 LABEL "kbytes / second" 580 RETURN 590 ! 600 X_label: ! Label X axis 610 LORG 4 620 LDIR 0 630 MOVE X_gdu_max/2,.02*Y_gdu_max 640 LABEL "log10 of I/O size(bytes)" 650 RETURN 660 ! 670 ! 680 Data_area: ! Create viewport and scale for data 690 ! and draw axes 700 VIEWPORT .1*X_gdu_max,.9*X_gdu_max,.15*Y_gdu_max,.9*Y_gdu_max 710 WINDOW -.1,6,-.7,50 ! Scale for our data 720 GRID 1,5,0,0 730 RETURN 740 ! 750 ! 760 Label_ticks: ! Now label tick marks 770 ! 780 ! x axis 790 CLIP OFF 800 CSIZE 4 810 LORG 6 820 FOR I=0 TO 6 STEP 1 830 MOVE I,-1 840 LABEL USING "#,K";I 850 NEXT I 860 ! 870 ! y axis 880 CLIP OFF 890 LORG 8 900 FOR I=0 TO 50 STEP 5 910 MOVE -.1,I 920 LABEL USING "#,DD";I 930 NEXT I 940 PENUP 950 RETURN 960 ! 970 Fillarrays: ! dimension and read data 980 DIM D2050(0:12),D3010(0:12) 990 DATA 0.102,0.305,1.009,3.158,9.514,10.018,11.750,11.882,11.903,12.002,12.019,12.024,12.025 1000 DATA 0.498,1.491, 4.956,14.713,37.995,39.995,44.577,45.474,45.747,46.174,46.130,45.933,46.149 1010 READ D2050(*) 1020 READ D3010(*) 1030 RETURN 1040 ! 1050 Plot2050: ! Plot 2050 data 1060 IF Colors THEN PEN 2 1070 MOVE 0,0 1080 FOR I=0 TO 12 1090 PLOT I/2,D2050(I) 1100 NEXT I 1110 MOVE 3.95,D2050(8)+3 1120 LORG 9 1130 LDIR 0 1140 LABEL "Agilent 2050" 1150 LORG 5 ! (add symbols) 1160 FOR I=0 TO 12 1170 MOVE I/2,D2050(I) 1180 LABEL "x" 1190 NEXT I 1200 PENUP 1210 RETURN 1220 ! 1230 Plot3010: ! Plot 3010 data 1240 IF Colors THEN PEN 3 1250 MOVE 0,0 1260 FOR I=0 TO 12 1270 PLOT I/2,D3010(I) 1280 NEXT I 1290 MOVE 3.95,D3010(8)+4 1300 LORG 9 1310 LABEL "TAMS 3010" 1320 LORG 5 !(add symbols) 1330 FOR I=0 TO 12 1340 MOVE I/2,D3010(I) 1350 LABEL "o" 1360 NEXT I 1370 PENUP 1380 RETURN 1390 ! 1400 Finishplot: ! 1410 !We have been writing to a file called "testplotfile" 1420 ! We want to close it, convert it, and print it. 1430 PLOTTER IS CRT,"INTERNAL" ! stop plotting to file 1440 EXECUTE ("hp2xx -q -r90 -p3 -m eps testplotfile") !convert hpgl to eps 1450 !EXECUTE ("lpr testplotfile.eps") 1460 EXECUTE ("display testplotfile.eps") 1470 DISP "all done" 1480 RETURN 1490 ! 1500 ! 1510 END |