如何使用gnuplot绘制数据文件中的特定数据子集? [英] How to plot a specific subset of data from a data file with gnuplot?
问题描述
我需要从数据文件中的一行绘制一个点,该点具有许多其他行和两行.我不知道如何在gnuplot中选择一行,而不是整个数据文件.有任何建议吗?
I need to plot a single point, from a line in data file, that has many other lines and two rows. I don't know how to select a single line in gnuplot, not the entire file of data. Any suggestions please???
推荐答案
如果要绘制的点不是以行号为特征,而是以一列中的某个值为特征,则可以在using
:
In case the point(s) you want to plot are not characterized by the line number, but by some value in one column, you can use this trick in using
:
plot '-' using (($1==0)?$1:1/0):2 with points
-1 1
0 2
1 3
e
这可以用来绘制例如仅使用x坐标为正的点(更改为($1>=0)?$1:1/0
),或者使用包含行号的$0
伪列,以比every
更通用的方式选择特定的行:
This can be used to plot e.g. only points with a positive x-coordinate (change to ($1>=0)?$1:1/0
), or also, using the $0
pseudo-column which contains the line number, to select specific lines in a more versatile way than every
:
plot 'data.dat' using (((int($0)%3!=0)?$1:1/0):2 with points
这里我们从3条图中绘制了2条线,当然,您也可以仅使用($0==LINE)?$1:1/0
选择一条线.
Here we plot 2 lines out of 3, of course you can also select one line only with ($0==LINE)?$1:1/0
.
这篇关于如何使用gnuplot绘制数据文件中的特定数据子集?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!