program graph4 implicit none call init call viewport(0.2,0.2,0.8,0.8) call xyworld(0.0,0.0,1.0,4.0) call frame call plotd call fin stop end real function f(x) implicit none real(4) x f=2.0*exp(4.0*x) return end subroutine plotd implicit none real(4),dimension(0:20)::x1,y1 integer i integer,parameter::n=20 real(4) f do i=0,n x1(i)=real(i)/real(n) y1(i)=f(x1(i)) end do do i=0,n y1(i)=alog10(y1(i)) end do call linewidth(1.5) call linety(1) call setgray(0.0) call plot(x1(0),y1(0),3) do i=1,n-2 call spline(x1(i-1),y1(i-1),x1(i),y1(i),x1(i+1),y1(i+1),x1(i+2),y1(i+2),-1) end do call spline(x1(n-3),y1(n-3),x1(n-2),y1(n-2),x1(n-1),y1(n-1),x1(n),y1(n),0) call spline(x1(n-3),y1(n-3),x1(n-2),y1(n-2),x1(n-1),y1(n-1),x1(n),y1(n),1) call stroke return end subroutine frame implicit none real(4) x,y,dx,dy integer,parameter::nx=1,ny=4 integer ix,iy,ixx,iyy call linewidth(1.0) call rect(0.0,0.0,1.0,4.0) call stroke do ix=0,nx-1 call setgray(0.5) x=real(ix) dy=4.0 if(ix/=0)then call plot(x,0.0,3) call plot(x,dy,2) call stroke end if do ixx=1,9 call setgray(0.8) x=real(ixx)/10.0 call plot(x,0.0,3) call plot(x,dy,2) call stroke end do end do do iy=0,ny-1 call setgray(0.5) y=real(iy) dx=1.0 if(iy/=0)then call plot(0.0,y,3) call plot(dx,y,2) call stroke end if do iyy=2,9 call setgray(0.8) y=real(iy)+alog10(real(iyy)) call plot(0.0,y,3) call plot(dx,y,2) call stroke end do end do call setgray(0.0) call textx(0.75,0.0,'x') call textx(0.0,0.02,'0') call textx(0.5,0.02,'0.5') call textx(1.0,0.02,'1') call texty(0.0,3.5,'y') call texty(0.0,0.0,'1') call texty(0.0,1.0,'10') call texty(0.0,2.0,'100') call texty(0.0,3.0,'1000') call texty(0.0,4.0,'10000') return end