I have a fortran code as below
program compute_plot
integer :: i, n = 10
real :: x(10), y(10)
x(1) = 0.0
y(1) = 0.0
do i = 2, n
x(i) = 0.1*i
y(i) = x(i)*x(i)
end do
open(unit = 5, file = 'data.txt')
do i = 1, n
write(5,*) x(i),y(i)
end do
close(5)
call system('gnuplot -p data_plot.gnu')
end program compute_plot
and another gnuplot script as below
reset
set terminal pngcairo dashed enhanced size 480,360 font 'arial,12' fontscale 1.0
set encoding utf8
set output 'plot.png'
set xlabel "x"
set ylabel "y"
m = "./data.txt"
set title 'The parabola'
plot m using 1:2 w l
These two code work well in Linux terminal, but I could not find a way to make them work in Windows command prompt. I also not sure if it is possible to make them work in Windows. Please advise.
gnuplotdo you start the gnuplot program or do you get something like a'gnuplot is not recognized....error?'gnuplot' is not recognized as an internal or external command, operable program or batch file.PATHenvironment variable (for example see here for how to do this on windows 7). You may want to use the commandwgnuplotinstead, if so you may find this helpful (which basically says don't as you may get some problems!).gnuplot.exeto thePATHenvironment variables and the code work perfectly now.