问题描述
使用GNU Plot,我通常在三个单独的列中处理x,y,z数据:
With GNU Plot, I normally process x, y, z data in three separate columns:
x1, y1, z1
x2, y1, z2
...
...
xn, yn, zn
然后我用splot 'filename.ext' with lines
快速获取3D图
and I used splot 'filename.ext' with lines
to quickly get the a 3D plot
由于我们对新系统的要求,我们必须以以下形式存储数据:
Due to our new system requirements, we have to store data in the following form:
x1
y1
z1
x2
y2
z2
.
.
xn
yn
zn
我已经用C#编写了一个简单的代码,将结果转换为3列,以便在GNU Plot中轻松查看.
I already written a simple code in C# to transform our results into 3 columns for easy viewing in GNU Plot.
我的问题是,如果数据现在只是一维数组,是否有一种方法可以直接在GNU Plot中绘制此图,而无需让我的程序将结果重新保存为3列结果?
My question is, if the data is now only a one dimensional array, is there a way to plot this in GNU Plot directly without having my program to re-saved our results as a 3 columns results?
谢谢.
关于,伊克尔
其他信息:我在64位Win7上运行,并使用GNU Plot的Win二进制文件.显然,我没有paste
,sed
和popen
(请参见下面的讨论).
Additional info: I am running on Win7, 64 bit, and using the Win binaries of GNU Plot. Apparently, I don't have paste
, sed
and popen
(see discussion below).
推荐答案
我不知道如何使Gnuplot将输入解释为三个一组,但是如果您的Gnuplot版本支持popen
,则可以加入这些行与飞粘贴或保存:
I don't know how to make Gnuplot interpret the input as groups of three, but if your version of Gnuplot supports popen
, you can join the lines on the fly with e.g. paste or sed:
splot '< paste - - - < filename.ext' with lines
或者:
splot '< sed "N; N; s/\n/ /g" filename.ext' with lines
这篇关于GNU绘图:绘制存储为一列的x,y,z值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!