使用 gnuplot 的动画:动画中仅绘制了一个曲线,而预期有 2 个

Animation with gnuplot : only one cruve plotted in an animation whereas 2 expected

我有以下脚本,预计会生成 2 条曲线的动画:

#!/bin/bash

for i in {1..397}; do
gnuplot -p <<-EOFMarker
set terminal png;
set output "pic$i.png";
set title "power spectrum";
set xlabel "scale (k)";
set ylabel "P(k)";
set key top left;
set grid;
set ytics out nomirror;
set xtics out nomirror;
set logscale x;
set logscale y;
set format x "10^{%L}";
set yrange [0:30000];
plot "CAMB-1.3.5/matter_camb$i" u 1:2 w l;
replot "EFTCAMB_v3_beta/matter_eftcamb$i" u 1:2 w l;
EOFMarker
done

# Build movie with ffmpeg
ffmpeg -start_number 1 -i pic%d.png  movie.mpeg

除了在动画中只绘制了一条曲线(CAMB-1.3.5)以外,其他都很好:

这里是框架的例子:

为什么生成的图像中没有考虑“replot”命令?

只是为了SO-rule“评论中没有答案”:

勾选help plot:

Syntax: 

      plot {<ranges>} <plot-element> {, <plot-element>, <plot-element>}
Examples: 

      plot sin(x)
      plot sin(x), cos(x)
      plot f(x) = sin(x*a), a = .2, f(x), a = .4, f(x)
      plot "datafile.1" with lines, "datafile.2" with points
      plot [t=1:10] [-pi:pi*2] tan(t), \
           "data.1" using (tan()):(/) smooth csplines \
                    axes x1y2 notitle with lines 5
      plot for [datafile in "spinach.dat broccoli.dat"] datafile