У меня есть несколько файлов .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 графика, соответствующие каждой фазе. В каждом из них я хочу построить первые 3 столбца из *_Basis_a.txt и *_Basis_b.txt, соответствующие этой фазе.
У меня есть следующий код, но он выдает ошибку 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
в правильном порядке - title
перед with
:
... using 0:2 title "Not nulled y" with lines lw 3 linecolor rgb "red"
Спасибо, перемещение заголовка раньше сработало.
Я не могу воспроизвести вашу проблему. Для меня
do for [n=1:4] {print sprintf("rp_sub-pilote3b_Phase.%d._Basis_a.txt", n)}
дает правильный вывод (то же самое для других строк).