我有以下的fortran代码
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
和另一个gnuplot脚本如下
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
这两个代码在Linux终端中运行良好,但我找不到让它们在Windows命令提示符下工作的方法。我也不确定是否可以在Windows中使用它们。请指教。
答案 0 :(得分:0)
F:Document
; F:\Documents\gnuplot\
; This PC
,点击Properties
,点击Advanced system settings
,点击Advanced
标签,点击Environment Variables...
; Path
窗口的顶部表格中选择Environment Variables
,然后点击Edit...
; New
添加gnuplot.exe
的路径,例如在我的桌面F:\Documents\gnuplot\bin
Command prompt
并运行gnuplot
命令。