Matrix 用gnuplot线绘制矩阵
我正在做一张图表,但我想用直线而不是点 使用线的样式,所有点都是连接的,并且图形具有网络外观,这是我不想要的Matrix 用gnuplot线绘制矩阵,matrix,gnuplot,Matrix,Gnuplot,我正在做一张图表,但我想用直线而不是点 使用线的样式,所有点都是连接的,并且图形具有网络外观,这是我不想要的 set grid set ticslevel 0.1 set samples 51, 51 set isosamples 20, 20 set border 1+2+4+8 unset key splot 'matrix.dat' matrix 将部分数据转换为矩阵图 这不能自动完成。必须确定矩阵的行和列。首先,要获取行数,请使用 stats 'matrix.dat' usin
set grid
set ticslevel 0.1
set samples 51, 51
set isosamples 20, 20
set border 1+2+4+8
unset key
splot 'matrix.dat' matrix
将部分数据转换为矩阵图
这不能自动完成。必须确定矩阵的行和列。首先,要获取行数,请使用
stats 'matrix.dat' using 1 nooutput
rows = STATS_records
有关列数,请使用then
stats 'matrix.dat' matrix nooutput
cols = STATS_records/rows
现在画出每一条线
unset key
splot for [i=0:cols-1] 'matrix.dat' matrix every ::i::i lt 1 with lines
结果(见4.6.4)为:
我认为Christoph的解决方案正是您所需要的,但为了明确这一点,通过提供矩阵并单独使用
splot matrix
将只生成一个网格
因此,您需要使用完整的X、Y和Z向量指定直线,然后使用splot和lines/linespoints打印它们。我在下面添加了一个例子,以防对其他人有所帮助
您可以按如下方式排列数据文件:
10 1 0.261 2 0.665 3 0.225 4 0.382 5 0.255 6 0.574 7 0.356
20 1 0.338 2 0.845 3 0.0363 4 0.167 5 0.727 6 0.0805 7 0.764
30 1 0.225 2 0.196 3 0.107 4 0.153 5 0.347 6 0.338 7 0.168
40 1 0.157 2 0.443 0.0671 4 0.135 5 0.312 6 0.408 7 0.362
然后绘制如下图:
set grid
set ticslevel 0.1
#set samples 51, 51
#set isosamples 20, 20
#set border 1+2+4+8
unset key
splot 'matrix.dat' using 1:2:3 with linespoints, \
'matrix.dat' using 1:4:5 with linespoints, \
'matrix.dat' using 1:6:7 with linespoints, \
'matrix.dat' using 1:8:9 with linespoints, \
'matrix.dat' using 1:10:11 with linespoints, \
'matrix.dat' using 1:12:13 with linespoints, \
'matrix.dat' using 1:14:15 with linespoints
用结果图
您使用的确切绘图命令是什么?你写了什么代码?你想要线图而不是点吗?@Zahaib我相信OP想要使用线,但当他这样做时,它们都连接在一起了。如果是这种情况,解决方案是在输入文件的序列之间放置空行。我同意,一些代码和一些示例数据会很有用。@TomFenech,的确,这似乎也是我的第一印象,但如果不看代码和数据文件,很难给出任何具体的建议。我使用splot'matrix.dat'matrix@ZahaibAkhtarI也同意你的观点,但是这个矩阵只是一个小部分,我会考虑很多要点。如果您需要,我将发送附件。-@Tomfenech以上,这是最干净的解决方案,或者您将必须指定每一行及其x、y和z向量,然后使用线或线点绘制感谢帮助。-@ZahaibAkhtarThanks通过帮助~@扎海巴赫塔
set grid
set ticslevel 0.1
#set samples 51, 51
#set isosamples 20, 20
#set border 1+2+4+8
unset key
splot 'matrix.dat' using 1:2:3 with linespoints, \
'matrix.dat' using 1:4:5 with linespoints, \
'matrix.dat' using 1:6:7 with linespoints, \
'matrix.dat' using 1:8:9 with linespoints, \
'matrix.dat' using 1:10:11 with linespoints, \
'matrix.dat' using 1:12:13 with linespoints, \
'matrix.dat' using 1:14:15 with linespoints