Gnuplot 绘制三维不等长数据

Gnuplot 绘制三维不等长数据,gnuplot,Gnuplot,我是gnuplot的新手,所以如果看起来很简单,请原谅。我有一个如下的数据文件,我想画一个这样的图表: t x = 0.00 0.20 0.40 0.60 0.80 1.00 0.00 0.000000 0.640000 0.960000 0.960000 0.640000 0.000000 0.02 0.000000 0.480000 0.800000

我是gnuplot的新手,所以如果看起来很简单,请原谅。我有一个如下的数据文件,我想画一个这样的图表:

t       x = 0.00        0.20        0.40        0.60        0.80        1.00
0.00    0.000000    0.640000    0.960000    0.960000    0.640000    0.000000
0.02    0.000000    0.480000    0.800000    0.800000    0.480000    0.000000
0.04    0.000000    0.400000    0.640000    0.640000    0.400000    0.000000
0.06    0.000000    0.320000    0.520000    0.520000    0.320000    0.000000
0.08    0.000000    0.260000    0.420000    0.420000    0.260000    0.000000
0.10    0.000000    0.210000    0.340000    0.340000    0.210000    0.000000
0.12    0.000000    0.170000    0.275000    0.275000    0.170000    0.000000
0.14    0.000000    0.137500    0.222500    0.222500    0.137500    0.000000
0.16    0.000000    0.111250    0.180000    0.180000    0.111250    0.000000
0.18    0.000000    0.090000    0.145625    0.145625    0.090000    0.000000
0.20    0.000000    0.072813    0.117813    0.117813    0.072813    0.000000
mesh(tplot,xplot,ttplot);
set xlabel "x"
set ylabel "t"
set zlabel "u"
set view 20,210
set border 4095 lw 2
set hidden3d
set xyplane 0
set autoscale fix
set nokey
set notics
splot "data" nonuniform matrix lt -1 lw 2 with lines

GNU倍频程等效命令如下:

t       x = 0.00        0.20        0.40        0.60        0.80        1.00
0.00    0.000000    0.640000    0.960000    0.960000    0.640000    0.000000
0.02    0.000000    0.480000    0.800000    0.800000    0.480000    0.000000
0.04    0.000000    0.400000    0.640000    0.640000    0.400000    0.000000
0.06    0.000000    0.320000    0.520000    0.520000    0.320000    0.000000
0.08    0.000000    0.260000    0.420000    0.420000    0.260000    0.000000
0.10    0.000000    0.210000    0.340000    0.340000    0.210000    0.000000
0.12    0.000000    0.170000    0.275000    0.275000    0.170000    0.000000
0.14    0.000000    0.137500    0.222500    0.222500    0.137500    0.000000
0.16    0.000000    0.111250    0.180000    0.180000    0.111250    0.000000
0.18    0.000000    0.090000    0.145625    0.145625    0.090000    0.000000
0.20    0.000000    0.072813    0.117813    0.117813    0.072813    0.000000
mesh(tplot,xplot,ttplot);
set xlabel "x"
set ylabel "t"
set zlabel "u"
set view 20,210
set border 4095 lw 2
set hidden3d
set xyplane 0
set autoscale fix
set nokey
set notics
splot "data" nonuniform matrix lt -1 lw 2 with lines

还有很多事情,如果你知道怎么做的话,这很简单。如果从数据文件中删除
x=
t
,则这是直接绘图,例如:

0           0.00        0.20        0.40        0.60        0.80        1.00
0.00    0.000000    0.640000    0.960000    0.960000    0.640000    0.000000
0.02    0.000000    0.480000    0.800000    0.800000    0.480000    0.000000
0.04    0.000000    0.400000    0.640000    0.640000    0.400000    0.000000
0.06    0.000000    0.320000    0.520000    0.520000    0.320000    0.000000
0.08    0.000000    0.260000    0.420000    0.420000    0.260000    0.000000
0.10    0.000000    0.210000    0.340000    0.340000    0.210000    0.000000
0.12    0.000000    0.170000    0.275000    0.275000    0.170000    0.000000
0.14    0.000000    0.137500    0.222500    0.222500    0.137500    0.000000
0.16    0.000000    0.111250    0.180000    0.180000    0.111250    0.000000
0.18    0.000000    0.090000    0.145625    0.145625    0.090000    0.000000
0.20    0.000000    0.072813    0.117813    0.117813    0.072813    0.000000
然后,数据可以解释为“非均匀”矩阵,尽管它是均匀的。这非常有用,因为它可以正确读取第一行和第一列。有关更多信息,请参见
帮助矩阵
帮助矩阵不一致
。例如:

echo 'splot "data" nonuniform matrix with lines' | gnuplot --persist
给我:

要使其与GNU Octave
mesh
命令生成的输出类似,请执行以下操作:

t       x = 0.00        0.20        0.40        0.60        0.80        1.00
0.00    0.000000    0.640000    0.960000    0.960000    0.640000    0.000000
0.02    0.000000    0.480000    0.800000    0.800000    0.480000    0.000000
0.04    0.000000    0.400000    0.640000    0.640000    0.400000    0.000000
0.06    0.000000    0.320000    0.520000    0.520000    0.320000    0.000000
0.08    0.000000    0.260000    0.420000    0.420000    0.260000    0.000000
0.10    0.000000    0.210000    0.340000    0.340000    0.210000    0.000000
0.12    0.000000    0.170000    0.275000    0.275000    0.170000    0.000000
0.14    0.000000    0.137500    0.222500    0.222500    0.137500    0.000000
0.16    0.000000    0.111250    0.180000    0.180000    0.111250    0.000000
0.18    0.000000    0.090000    0.145625    0.145625    0.090000    0.000000
0.20    0.000000    0.072813    0.117813    0.117813    0.072813    0.000000
mesh(tplot,xplot,ttplot);
set xlabel "x"
set ylabel "t"
set zlabel "u"
set view 20,210
set border 4095 lw 2
set hidden3d
set xyplane 0
set autoscale fix
set nokey
set notics
splot "data" nonuniform matrix lt -1 lw 2 with lines
其结果是:


谢谢你,托尔,回答得很好。