program f90_PSHD implicit none integer,parameter::nn=50,mm=9 character(len=50)::fnameR,fnameF character(len=50)::sname(1:nn),stype(1:nn),sclass(1:nn),stbrl(1:nn) integer::mark(1:nn) real(4)::year(1:nn),HD(1:nn) real(4)::xmin,xmax,dx,ymin,ymax,dy real(4)::xx,yy,sx,sy character(len=50)::sxlabel,sylabel integer::i,n,io,k character(len=1000)::linebuf character(len=50)::str1,str2,str3 call getarg(1,fnameR) !Input file name open(11,file=fnameR,status='old') read(11,'(a)') sxlabel read(11,'(a)') sylabel read(11,*) xmin,xmax,dx read(11,*) ymin,ymax,dy read(11,'()') i=0 do i=i+1 read(11,*,iostat=io) sname(i),stype(i),year(i),HD(i),sclass(i),stbrl(i) if(io<0)exit end do n=i-1 close(11) do i=1,n if(index(stype(i),'C')/=0.and.index(sclass(i),'400MPa')/=0)mark(i)=1 if(index(stype(i),'C')/=0.and.index(sclass(i),'490MPa')/=0)mark(i)=2 if(index(stype(i),'P')/=0.and.index(sclass(i),'490MPa')/=0)mark(i)=3 if(index(stype(i),'C')/=0.and.index(sclass(i),'570MPa')/=0)mark(i)=4 if(index(stype(i),'P')/=0.and.index(sclass(i),'570MPa')/=0)mark(i)=5 if(index(stype(i),'C')/=0.and.index(sclass(i),'690MPa')/=0)mark(i)=6 if(index(stype(i),'P')/=0.and.index(sclass(i),'690MPa')/=0)mark(i)=7 if(index(stype(i),'P')/=0.and.index(sclass(i),'780MPa')/=0)mark(i)=8 if(index(stype(i),'P')/=0.and.index(sclass(i),'950MPa')/=0)mark(i)=9 end do open(12, file='gpl_PSHD.txt', status='replace') write(12,'(a)') 'set terminal postscript eps font "Arial-narrow" 12' write(12,'(a)') 'set output "fig_gpl_PSHD.eps"' write(12,'(a)') 'set size ratio 0.7' write(12,'(a)') 'set key left top' write(12,'(a)') 'set key reverse' write(12,'(a)') 'set key Left' write(12,'(a)') 'set key width -6' write(12,'(a)') 'set key box' write(12,'(a)') 'set key title "Tensile strength and Type of P/S"' write(12,'(a)') 'set key spacing 1.2' write(12,'(a)') 'set bmargin 6' write(12,'(a)') 'set title "Fig. Change of scale of Penstock in Japan" offset 0,-41 font "Arial-Bold,16"' !Label of axis linebuf='set xlabel "'//trim(adjustl(sxlabel))//'"' write(12,'(a)') trim(adjustl(linebuf)) linebuf='set ylabel "'//trim(adjustl(sylabel))//'"' write(12,'(a)') trim(adjustl(linebuf)) !xrange,xtics,format write (str1,*) xmin write (str2,*) xmax write (str3,*) dx linebuf='set xrange ['//trim(adjustl(str1))//':'//trim(adjustl(str2))//']' write(12,'(a)') trim(adjustl(linebuf)) linebuf='set xtics '//trim(adjustl(str3)) write(12,'(a)') trim(adjustl(linebuf)) write(12,'(a)') 'set format x "%.0f"' write(12,'(a)') trim(adjustl(linebuf)) !yrange,ytics,format write (str1,*) ymin write (str2,*) ymax write (str3,*) dy linebuf='set yrange ['//trim(adjustl(str1))//':'//trim(adjustl(str2))//']' write(12,'(a)') trim(adjustl(linebuf)) linebuf='set ytics '//trim(adjustl(str3)) write(12,'(a)') trim(adjustl(linebuf)) write(12,'(a)') 'set format y "%.0f"' !Label sx=0.010 sy=0.025 do i=1,n if(index(stbrl(i),'x')/=0)cycle xx=(year(i)-xmin)/(xmax-xmin) yy=(HD(i)-ymin)/(ymax-ymin) if(index(stbrl(i),'t')/=0)then str3='center' yy=yy-sy end if if(index(stbrl(i),'b')/=0)then str3='center' yy=yy+sy end if if(index(stbrl(i),'r')/=0)then str3='right' xx=xx-sx end if if(index(stbrl(i),'l')/=0)then str3='left' xx=xx+sx end if write (str1,*) xx write (str2,*) yy linebuf='set label "'//trim(adjustl(sname(i)))//'" at graph '//trim(adjustl(str1))//',graph '//trim(adjustl(str2))& //' '//trim(adjustl(str3))//' font "Arial Narrow,12"' write(12,'(a)') trim(adjustl(linebuf)) end do write(12,'(a)') 'set grid xtics ytics mxtics mytics' write(12,'(a)') 'plot \' write(12,'(a)') '"-" with points pointtype 12 pointsize 1.0 title "400MPa: Conventional ",\' write(12,'(a)') '"-" with points pointtype 6 pointsize 1.0 title "490MPa: Conventional ",\' write(12,'(a)') '"-" with points pointtype 7 pointsize 1.0 title "490MPa: Pumped-storage",\' write(12,'(a)') '"-" with points pointtype 4 pointsize 1.0 title "570MPa: Conventional ",\' write(12,'(a)') '"-" with points pointtype 5 pointsize 1.0 title "570MPa: Pumped-storage",\' write(12,'(a)') '"-" with points pointtype 8 pointsize 1.0 title "690MPa: Conventional ",\' write(12,'(a)') '"-" with points pointtype 9 pointsize 1.0 title "690MPa: Pumped-storage",\' write(12,'(a)') '"-" with points pointtype 21 pointsize 1.3 title "780MPa: Pumped-storage",\' write(12,'(a)') '"-" with points pointtype 37 pointsize 1.3 title "950MPa: Pumped-storage"' do k=1,mm do i=1,n if(index(stbrl(i),'x')/=0)cycle if(mark(i)==k)write(12,'(2i5," #",a)') int(year(i)),int(HD(i)),trim(adjustl(sname(i))) end do write(12,'(a)') 'e' end do write(12,'(a)') 'quit' close(12) call system('gnuplot "gpl_PSHD.txt"') stop contains subroutine del_spaces(s) character (*), intent (inout) :: s character (len=len(s)) tmp integer i, j j = 1 do i = 1, len(s) if (s(i:i)==' ') cycle tmp(j:j) = s(i:i) j = j + 1 end do s = tmp(1:j-1) end subroutine del_spaces end program f90_PSHD