Gnuplot 脚本错误 "invalid expression"

Gnuplot script error "invalid expression"

下面是用于为 gif 文件输出连续图像的代码:

for i in {1..600}
do
python Phy_asg.py $i
gnuplot <<- EOF
    unset tics;unset key;unset border
    set xrange [-15:15]
    set yrange [-15:15]
    set arrow 1 from 0.012*$i,cos(0.012*$i)-pi to sin(0.024*$i),cos(0.012*$i ) nohead ls 8 lw 2
    set arrow 2 from sin(0.024*$i)+pi,0.012*$i to sin(0.024*$i),cos(0.012*$i ) nohead ls 8 lw 2
    plot "< seq -9 .2 -3.1" u (cos(2*)):() with lines
    replot "< seq -9 .2 -3.1" u ():(cos(2*)) with lines
    replot "data_asg.txt" with lines lt 22 lw 2
    set terminal png size 512,512
    set output "Phy_gif_$i.png"
    replot
EOF
done

这里的 Phy_asg.py 是 python 脚本,用于生成文本文件形式的数据,其名称是 data_asg.txt。 shell 在第 10 行给我错误。它说:

gnuplot> plot "< seq -9 .2 -3.1" u (cos(2*)):() with lines
                                      ^
     line 0: invalid expression

我无法找出问题所在。是seq命令还是格式错误

</code> 被解释为 shell 参数而不是数据列。要么逃避美元,<code>$1要么使用column(1),我更喜欢后者

for i in {1..600}
do
python Phy_asg.py $i
gnuplot <<- EOF
    set terminal png size 512,512
    set output "Phy_gif_$i.png"
    unset tics;unset key;unset border
    set xrange [-15:15]
    set yrange [-15:15]
    set arrow 1 from 0.012*$i,cos(0.012*$i)-pi to  sin(0.024*$i),cos(0.012*$i ) nohead ls 8 lw 2
    set arrow 2 from sin(0.024*$i)+pi,0.012*$i to sin(0.024*$i),cos(0.012*$i ) nohead ls 8 lw 2
    set style data lines
    plot "< seq -9 .2 -3.1" u (cos(2*column(1) )):1, \
         "< seq -9 .2 -3.1" u 1:(cos(2*column(1))), \
         "data_asg.txt" lt 22 lw 2
EOF
done