Plot

Developer(s): Owen Christianson
Date: 198x
Type: Program
Platform(s): TS 2068

Plot cartesian data, optionally connect the points.

Gallery

Plot

Source Code

    5 GO TO 9000
    6 LET init=64324
    7 LET rot=64256
    8 LET mir=64281
   10 PRINT "Plotting Routine"
   11 PRINT 
   20 INPUT "Xmax ";xmax,"Xmin ";xmin
   21 PRINT "Xmin=";xmin,"Xmax=";xmax
   30 INPUT "Ymax ";ymax,"Ymin ";ymin
   31 PRINT "Ymin=";ymin,"Ymax=";ymax
   40 INPUT "number of data points ",n
   41 PRINT "number of data points=";n
   42 DIM x(n): DIM y(n)
   50 FOR d=1 TO n
   55 PRINT AT 21,0;"data point number ";d
   60 INPUT "x=";x(d),"y=";y(d)
   70 NEXT d
  110 INPUT "input X label ";x$
  115 PRINT AT 6,0;"X label: ";x$
  116 LET xl=LEN x$
  117 IF xl>25 THEN GO TO 110
  120 INPUT "input Y label ";y$
  125 PRINT "Y label: ";y$
  126 LET yl=LEN y$
  127 IF yl>18 THEN GO TO 120
  130 INPUT "connect data points?";c$
  131 IF c$="y" THEN PRINT "data points will be connected"
  200 CLS 
  210 GO SUB 1000
  220 IF c$<>"y" THEN GO SUB 2000
  230 IF c$="y" THEN GO SUB 3000
  250 GO SUB 5000
  300 STOP 
 1000 PLOT 33,25
 1010 DRAW 200,0
 1020 DRAW 0,150
 1030 DRAW -200,0
 1040 DRAW 0,-150
 1050 FOR i=1 TO 9
 1060 PLOT 33+20*i,25
 1070 DRAW 0,2
 1080 PLOT 33+20*i,175
 1090 DRAW 0,-2
 1100 PLOT 33,25+15*i
 1110 DRAW 2,0
 1120 PLOT 233,25+15*i
 1130 DRAW -2,0
 1140 NEXT i
 1150 RETURN 
 2000 FOR d=1 TO n
 2010 PLOT 33+(x(d)-xmin)/(xmax-xmin)*200,25+(y(d)-ymin)/(ymax-ymin)*150
 2020 NEXT d
 2030 RETURN 
 3000 PLOT 33+(x(1)-xmin)/(xmax-xmin)*200,25+(y(1)-ymin)/(ymax-ymin)*150
 3010 FOR d=2 TO n
 3020 DRAW (x(d)-x(d-1))/(xmax-xmin)*200,(y(d)-y(d-1))/(ymax-ymin)*150
 3030 NEXT d
 3040 RETURN 
 5000 LET xl=LEN x$
 5010 LET xp=16-xl/2
 5030 PRINT AT 21,xp;x$
 5040 PRINT AT 19,4;INT xmin;AT 19,16;INT ((xmax-xmin)/2);AT 19,29;INT xmax
 5050 LET yl=LEN y$
 5060 LET yp=9+yl/2
 5070 RANDOMIZE USR init
 5080 POKE 23606,0: POKE 23607,251
 5090 RANDOMIZE USR rot
 5100 FOR p=1 TO yl
 5110 PRINT AT yp-p,0;y$(p)
 5120 NEXT p
 5130 RANDOMIZE USR init
 5131 LET p$=STR$ INT ymin
 5132 LET lw=LEN p$
 5133 LET p$=STR$ INT ((ymax-ymin)/2)
 5134 LET md=LEN p$
 5135 LET p$=STR$ INT ymax
 5136 LET up=LEN p$
 5140 PRINT AT 18,4-lw;INT ymin;AT 9,4-md;INT ((ymax-ymin)/2);AT 0,4-up;INT ymax
 5150 RETURN 
 9000 CLEAR 64255
 9010 DATA 033,000,252,001,000,252,197,221
 9011 DATA 033,080,251,006,001,022,008,229
 9012 DATA 014,000,126,160,040,002,203,193
 9013 DATA 203,001,121,035,021,032,243,221
 9014 DATA 119,000,221,035,225,203,000,048
 9015 DATA 228,035,035,035,035,035,035,035
 9016 DATA 035,209,229,033,080,251,001,008
 9017 DATA 000,237,176,225,213,124,254,255
 9018 DATA 032,197,193,201,033,000,061,017
 9019 DATA 000,252,001,000,003,237,176,201
 9020 FOR a=64256 TO 64335
 9030 READ d: POKE a,d: NEXT a: GO TO 6
 9040 REM "plot" by Owen Christianson  822 Richmond Ave.  Buffalo NY  14222
Scroll to Top