I have multiple .txt files of the naming order
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
I want to create 4 plots corresponding to each phase. In each of these, I want to plot the first 3 columns from *_Basis_a.txt and *_Basis_b.txt corresponding to that phase.
I have the following code, but it produces the error 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"
}
CodePudding user response:
Can't reproduce your problem exactly, my gnuplot version 5.4.1 shows another error message:
line 20: duplicated or contradicting arguments in plot options
This can be solved by putting the arguments for plot
in the correct order - title
before with
:
... using 0:2 title "Not nulled y" with lines lw 3 linecolor rgb "red"