gnuplot循环数据文件和3D绘图的迭代器(gnuplot looping data files and an iterator for 3D plot)

编程入门 行业动态 更新时间:2024-10-23 10:27:11
gnuplot循环数据文件和3D绘图的迭代器(gnuplot looping data files and an iterator for 3D plot)

我试图将一组2D数据文件绘制到单个3D图上,如围栏图。 虽然我在创建两个迭代器时同时循环数据文件和x轴值,但遇到问题。

我尝试了这样的事情:

list = system('dir /b *.csv') x = 0 do for [file in list] { splot file using (x):1:2 with l x=x+1 }

这似乎不起作用。 我得到最初的情节,但没有后来的参赛作品。 实际的文件和变量是迭代的,但我猜测变量是计算一次,而不是在splot命令内更新。

我想要处理的数据量使得定义文件列表和x轴值成为一项不重要的任务。 否则,我会这样做。

I'm trying to plot a set of 2D data files onto a single 3D plot, like a fence plot. I'm having trouble creating two iterators to loop both the data files and the x-axis values at the same time though.

I tried something like this:

list = system('dir /b *.csv') x = 0 do for [file in list] { splot file using (x):1:2 with l x=x+1 }

which doesn't seem to work. I get the initial plot, but none of the later entries. The actual file and variable is iterating, but I'm guessing the variable is calculated once and not updated inside the splot command.

The amount of data I want to work with makes defining the file list and the x axis value a non-trivial task. Otherwise I would just do that.

最满意答案

使用函数来更改变量。

list = system('dir /b *.csv') f(x)=(x=x+1, x-1) x = 0 splot for [file in list] file using (f(x)):1:2 w l

Use function to change variable.

list = system('dir /b *.csv') f(x)=(x=x+1, x-1) x = 0 splot for [file in list] file using (f(x)):1:2 w l

更多推荐

本文发布于:2023-08-07 16:43:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1465099.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:迭代   文件   数据   gnuplot   looping

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!