set ylabel "x^2"
set y2label "26-2x"
set y2tics
set ytics nomirror

plot "a.dat" u 1:2 w l axis x1y1 t "x^2","a.dat" u 1:3 w l axis x1y2 t "26-2x" 

效果如图:

gnuplot画双纵坐标图


生成"a.dat"的Fortran程序:

program HelloWorld
        integer i
        real x(40),y1(40),y2(40)
        
        OPEN(10,file="a.dat")
        write(10,200)"#x","y1","y2"
200     format(3A15)


        do i=1,40
          x(i)=(i-1)*0.1
          y1(i)=x(i)**2
          y2(i)=26.0-2.0*x(i)
            write(10,*)x(i),y1(i),y2(i)
          
        end do
        CLOSE(10)
        
        STOP
        end

相关文章: