Gnuplot 如何在一个csv(都是一行)中绘制每N个数据点

Gnuplot 如何在一个csv(都是一行)中绘制每N个数据点,gnuplot,Gnuplot,我的任务是绘制一些数据,这些数据是由一个显然厌恶换行符/列的人生成的 我有一个格式如下的文件: i0,x0,y0,i1,x1,y2,i2,x2,y2,i3,x3,y3,…in,xn,yn 我需要绘制I和y 我遇到过“every”命令,但这似乎是用于跳过数据中的行和列 我正在Windows7上运行gnuplot 4.6。这只能在gnuplot中完成吗?如果没有,插入新行字符的最佳方式是什么。我可以跳到Linux机器上,但它没有可用的gnuplot。无论哪种方式,我更喜欢一个独立的plt文件,因为这

我的任务是绘制一些数据,这些数据是由一个显然厌恶换行符/列的人生成的

我有一个格式如下的文件:

i0,x0,y0,i1,x1,y2,i2,x2,y2,i3,x3,y3,…in,xn,yn

我需要绘制I和y

我遇到过“every”命令,但这似乎是用于跳过数据中的行和列


我正在Windows7上运行gnuplot 4.6。这只能在gnuplot中完成吗?如果没有,插入新行字符的最佳方式是什么。我可以跳到Linux机器上,但它没有可用的gnuplot。无论哪种方式,我更喜欢一个独立的plt文件,因为这将再次出现

是的,您可以绘制这些数据,但这需要一些技巧,因为gnuplot通常逐行读取数据

必须使用
矩阵
读取数据,保存第三列的值,从第0列开始,然后在读取y值时将保存的值用作x值(列数模3==2):

用测试数据

0.1,2,3,0.2,5,6,0.4,8,9,0.8,11,12,1.6,14,15,3.2,17,18
我知道情节

请注意,只有gnuplot版本5.0才能获得线图。在4.6中,
1/0
会导致行中断,并且您只能看到点

对于以前的版本,必须首先将数据打印到中间文件,然后使用常规的plot命令再次打印:

set datafile separator ','
x = 0
set table 'test.tab'
plot 'test.dat' matrix using (int($1) % 3 == 0 ? x = $3 : x = x, (int($1) % 3 == 2 ? x : 1/0)):(int($1) % 3 == 2 ? $3 : 1/0) w lp ps 2 pt 7 
unset table

set datafile separator white
plot 'test.tab' using 1:2 every 3::2 w lp ps 2 pt 7 
set datafile separator ','
x = 0
set table 'test.tab'
plot 'test.dat' matrix using (int($1) % 3 == 0 ? x = $3 : x = x, (int($1) % 3 == 2 ? x : 1/0)):(int($1) % 3 == 2 ? $3 : 1/0) w lp ps 2 pt 7 
unset table

set datafile separator white
plot 'test.tab' using 1:2 every 3::2 w lp ps 2 pt 7