gnuplot: internal error : STRING operator applied to undefined or non-STRING variable

gnuplot: internal error : STRING operator applied to undefined or non-STRING variable

我有多个命名顺序的 .txt 文件

rp_sub-pilote3b_Phase1_Basis_a.txt rp_sub-pilote3b_Phase1_Basis_b.txt
rp_sub-pilote3b_Phase1_Basis_a.txt rp_sub-pilote3b_Phase1_Basis_b.txt
rp_sub-pilote3b_Phase1_Basis_a.txt rp_sub-pilote3b_Phase1_Basis_b.txt
rp_sub-pilote3b_Phase1_Basis_a.txt rp_sub-pilote3b_Phase1_Basis_b.txt

我想创建对应于每个阶段的 4 个地块。在其中的每一个中,我都想绘制与该阶段对应的 *_Basis_a.txt 和 *_Basis_b.txt 的前 3 列。 我有以下代码,但它会产生错误 line 20: internal error : STRING operator applied to undefined or non-STRING variable

#load this this with  "./gnuplot.txt"
#set terminal qt enhanced 40


set terminal postscript enhanced color solid  "Helvetica" 10
set out "motion_translation.ps"
set key left bottom # for Position of Legend

set title "Motion across timesteps"   font "Helvetica,10"
set ylabel "displacement in mm"  font "Helvetica,10"
set xlabel "|time in TR"  font "Helvetica,10"
set size ratio 0.6

do for [n=1:4]{
    plot    sprintf("rp_sub-pilote3b_Phase.%d._Basis_a.txt", n) using 0:1  with lines lw 3  title "Not nulled x"  linecolor rgb "green" ,\
        sprintf("rp_sub-pilote3b_Phase.%d._Basis_a.txt", n) using 0:2  with lines lw 3 title "Not nulled y"  linecolor rgb "red" ,\
        sprintf("rp_sub-pilote3b_Phase.%d._Basis_a.txt", n) using 0:3  with lines lw 3 title "Not nulled z"  linecolor rgb "brown" ,\
        sprintf("rp_sub-pilote3b_Phase.%d._Basis_b.txt", n) using 0:1  with lines lw 3 title "nulled x"  linecolor rgb "turquoise" ,\
        sprintf("rp_sub-pilote3b_Phase.%d._Basis_b.txt", n) using 0:2  with lines lw 3 title "nulled y"  linecolor rgb "pink" ,\
        sprintf("rp_sub-pilote3b_Phase.%d._Basis_b.txt", n) using 0:3  with lines lw 3 title "nulled z"  linecolor rgb "black"
}

无法准确重现您的问题,我的 gnuplot 版本 5.4.1 显示了另一条错误消息:

line 20: duplicated or contradicting arguments in plot options

这可以通过将 plot 的参数按正确的顺序放置来解决 - titlewith 之前:

... using 0:2 title "Not nulled y" with lines lw 3 linecolor rgb "red"