home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume1 / 8710 / 14 / axis.f next >
Encoding:
Text File  |  1990-07-13  |  2.8 KB  |  93 lines

  1.       subroutine axis(x,y,lbl,nc,s,theta,amin,delta)
  2.     save
  3. c
  4. c        this subroutine draws an axis with "tic" marks at one inch
  5. c        intervals with their associated values and addelta a label.
  6. c        the arguments are:
  7. c            x,y = the coordinates in inches of the starting point of
  8. c                  the axis
  9. c            lbl = a holerith string that will be used as the axis label
  10. c                  it is centered and drawn in 0.14 inch high letters.
  11. c            nc  = number of characters in lbl. if pos, label, scale, &
  12. c                  tic marks are drawn on ccw side of the axis. if neg,
  13. c                  they are placed on the cw side.
  14. c            s   = the length of the axis in inches.
  15. c            theta = the angle in degrees from the +x direction that the
  16. c                  axis is drawn. =0 implies a horizontal axis reading
  17. c                  left to right. =90 implies a verticle axis reading
  18. c                  bottom to top.
  19. c            amin = the minimum value shown on the axis.
  20. c            delta  = the scale increment per inch on the scale.
  21. c
  22.       dimension lbl(1) , jdl(1)
  23. c
  24. c            nn  =specifies the number of digits affter the decimal
  25. c                 point on numeric lettering. calcomp versions allow
  26. c                 only 2 positions after the decimal.
  27. c
  28.       data nn/2/,jdl/4h *10/
  29.       xb=x
  30.       yb=y
  31.       ymin=amin
  32.       n=s+.5
  33.       nac=iabs(nc)
  34.       yyd=.5*s-.06*nac
  35.       angrad=1.7453293e-2*theta
  36.       f=cos(angrad)
  37.       g=sin(angrad)
  38.       sgn=isign(1,nc)
  39.       fsv=sgn*f
  40.       gsv=sgn*g
  41.       t=-.07*(sgn-1.)
  42.       shftx=t*gsv
  43.       shfty=t*fsv
  44.       xa=xb-.1*gsv
  45.       ya=yb+.1*fsv
  46.       xc=xb-.15*gsv-.17*f-shftx
  47.       yc=yb+.15*fsv-.17*g+shfty
  48.       xd=xb+yyd*f-.33*gsv-shftx
  49.       yd=yb+yyd*g+.33*fsv+shfty
  50.       exp=0.
  51.       dd=abs(delta)
  52.       if (dd.ge..01.and.dd.le.100.) go to 50
  53.       nac=nac+4
  54.    10 if (dd.lt..01) go to 40
  55.    20 if (dd.gt.100.) go to 30
  56.       go to 50
  57.    30 dd=dd*.1
  58.       ymin=ymin*.1
  59.       exp=exp+1.
  60.       go to 20
  61.    40 dd=dd*10.
  62.       ymin=ymin*10.
  63.       exp=exp-1.
  64.       go to 10
  65.    50 call number(xc,yc,.105 ,ymin,theta,nn)
  66.       dd=sign(dd,delta)
  67.       do 60 i = 1,n
  68.       call plot(xa,ya,1)
  69.       call plot(xb,yb,2)
  70.       xa=xa+f
  71.       xb=xb+f
  72.       xc=xc+f
  73.       ya=ya+g
  74.       yb=yb+g
  75.       yc=yc+g
  76.       ymin=ymin+dd
  77.       call plot(xb,yb,1)
  78.       call plot(xa,ya,1)
  79.    60 call number(xc,yc,.105,ymin,theta,nn)
  80.       if (exp) 80,70,80
  81.    70 call symbol(xd,yd,.14,lbl,theta,nac)
  82.       return
  83.    80 ncc=nac-4
  84.       call symbol(xd,yd,.14,lbl,theta,ncc)
  85.       call where(aa,bb,fact)
  86.       call symbol(aa,bb,.14,jdl,theta,4)
  87.       call where(aa,bb,fact)
  88.       aa=aa+cos(angrad)*(.08)-sin(angrad)*.08
  89.       bb=bb+sin(angrad)*(.08)+cos(angrad)*.08
  90.       call number(aa,bb,.07,exp,theta,-1)
  91.       return
  92.       end
  93.