1

I have a file in the form

# Line 1
# x y z
  x11 y11 z11 
  x12 y12 z12
  .... 
  x1n y1n z1n
  ( blank row )

 .....


# Line N
# x y z
  xN1 y11 z11 
  xN2 y12 z12
  .... 
  xNk yNk zNk

If I try to splot such file, gnuplot intended it as a surface, and the result is very awful (because the endpoint of a line is close to the endpoint of next line, not to the first point). How can I plot them as different lines (as every line was in a different file)?

4

1 回答 1

1

坐标的每个连续部分称为 a block。两个blocks 由一个空白行分隔。(注意,两个空白行将两个数据集分开,可以使用 访问index)。

您可以使用以下选项选择特定行进行绘图every

block = 4
splot 'file.dat' every :::block::block

这将选择第五个block(编号从 开始0)。

要遍历所有可用块,您可以使用以下stats命令估计块数:

stats 'file.dat'
splot for [i=0:int(STATS_blank)] 'file.dat'

请注意,文件末尾的一些不分隔块的空白也被计算在内,但这对于迭代没有问题。

您当然也可以使用迭代变量i来选择某个linetypelinestyle

于 2013-10-15T18:47:10.967 回答