首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Gnuplot:多个"for“循环导致图幅相乘

Gnuplot:多个"for“循环导致图幅相乘
EN

Stack Overflow用户
提问于 2015-07-09 18:46:57
回答 1查看 346关注 0票数 0

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

目前,这项工作是:

代码语言:javascript
运行
复制
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"    

我有很多要画的,所以我试着用循环。我已经走了这么远:

代码语言:javascript
运行
复制
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]参数之后添加for,“但是当我这样做的时候,我得到了36个样地(6组被400抵消)。

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

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-07-09 18:54:30

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

你应该考虑以下选择:

代码语言:javascript
运行
复制
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)
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/31325804

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档