本文介绍了gnuplot循环与区间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有下面的gnuplot脚本,它使用for循环将(x,y)格式的100个数据集绘制到一个绘图。但是,脚本只绘制2个数据集。任何人都可以帮忙吗?
I have the following gnuplot script that uses a for loop to plot 100 data sets of (x,y) format to one plot. However, the script only plots 2 data sets. Can anybody help? Thank you.
plotfile = "graph.eps"
set output plotfile
filename(n) = sprintf("%d_mod.int", n)
plot for [i = 400000:4000000:400000] filename(i) u 1:2 title sprintf("%d", i) w lp
推荐答案
这是一个bug,将在4.6.6和5.0 ,请参阅。
That is a bug, which will be fixed in 4.6.6 and 5.0, see #1429 Erratic behaviour of do for loops .
作为一种解决方法,您必须迭代较小的数字:
As a workaround you must iterate over smaller numbers:
plot for [i = 4:40:4] filename(i*100000) u 1:2 title sprintf("%d", i*100000) w lp
这篇关于gnuplot循环与区间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!