Loops Gnuplot:Multiple";至于;循环导致绘图成倍增加

Loops Gnuplot:Multiple";至于;循环导致绘图成倍增加,loops,gnuplot,Loops,Gnuplot,我试图在一张图上绘制多个XRD图案,它们之间有一个垂直偏移。例如,文件名为E65.xy 目前,这项工作: reset set xlabel "2 Theta" set ylabel "Intensity" set xrange [5:60] set key outside right set border 3 set xtics nomirror set ytics nomirror set terminal pdf color font 'times new roman,17' set ou

我试图在一张图上绘制多个XRD图案,它们之间有一个垂直偏移。例如,文件名为E65.xy

目前,这项工作:

reset 
set xlabel "2 Theta"
set ylabel "Intensity"
set xrange [5:60]
set key outside right
set border 3
set xtics nomirror
set ytics nomirror
set terminal pdf color font 'times new roman,17'
set output "XRD_E65.pdf"
offset = 400
plot 'E58.xy' using 1:($2 + offset*5)   with lines ls 1 lc 1 title "E58 XRD"    , \
    'E59.xy' using 1:($2 + offset*4)    with lines ls 1 lc 2 title "E59 XRD"    , \
    'E61.xy' using 1:($2 + offset*3)    with lines ls 1 lc 3 title "E61 XRD"    , \
    'E62.xy' using 1:($2 + offset*2)    with lines ls 1 lc 4 title "E62 XRD"    , \
    'E64.xy' using 1:($2 + offset*1)    with lines ls 1 lc 5 title "E64 XRD"    , \
    'E65.xy' using 1:($2 + offset*0)    with lines ls 1 lc 6 title "E65 XRD"    
我有很多要绘制的,所以我尝试使用循环。我成功地做到了这一点:

offset = 400
explist = "58 59 61 62 64 65"
plot for [exp in explist] "E".exp.".xy" using 1:($2 + offset * (count) ) with lines title "E".exp
它将所有六种图案相互叠加。我一直想在第一个
for
参数之后为[count=1:6]添加
,但当我这样做时,我得到了36个绘图(六组绘图偏移400)


我想我理解为什么会发生这种情况,但我找不到解决办法。

通过为[count=1:6]添加
实际上创建了一个嵌套循环,从而绘制了偏移量和exp值的所有可能组合

你应该考虑以下的选择:

offsetlist = "5 4 3 2 1 0"
explist = "58 59 61 62 64 65"
plot for [i=1:6] "E".word(explist, i).".xy" using 1:($2 + word(offsetlist, i)) w l title "E".word(explist, i)

谢谢,在
word(offsetlist,i)
之前添加了
offset*
,可以正常工作。没有这个乘数,很难看到偏移量,因为峰值很高。没错,我没有注意偏移乘数!