绘制脚本中包含的数据会导致循环失败 [英] Plotting data included in script fails in loop

查看:58
本文介绍了绘制脚本中包含的数据会导致循环失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想绘制脚本文件中包含的数据点.这应该做多次(绘制到不同的文件).因此,我正在使用do-for-loop.

I would like to plot data points included inside a script file. This should be done multiple times (plotting to different files). Therefore, I am using a do-for-loop.

此循环让Gnuplot在执行时冻结.您能提示我原因吗?

This loop let's Gnuplot freeze on excution. Could you please hint me to the cause?

这是我的MWE:

reset
set autoscale

do for [index=1:1] {
plot "-" with lines ls 2 notitle
0.500 5
1.000 6
1.500 7
e
}

推荐答案

是的,似乎不支持将 do for 与内联数据结合使用.这也不是很方便,因为每次迭代都需要一个单独的数据块,例如

Yes, seems like the combination of do for with inline data isn't supported. It also wouldn't be very convenient, since this would require a separate data block for every iteration like in

set style data linespoints
plot '-' using 1:2, '-' using 1:3
1 2 3
4 5 6
e
1 2 3
4 5 6
e

在版本5.0中引入了内联数据块,这些数据块允许重复使用内联数据:

With version 5.0 inline data blocks were introduced which allow reusing inline data:

$data <<EOD
1 2 3
4 5 6
EOD
do for [i=2:3] {
    plot $data using 1:i w l
    pause -1
}

这篇关于绘制脚本中包含的数据会导致循环失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆