gnuplot:数据矩阵的三维绘图

gnuplot:数据矩阵的三维绘图,gnuplot,Gnuplot,如何在Gnuplot中绘制(3D绘图)具有这种数据结构的矩阵, 使用第一行和第一列作为x和y记号(第一行的第一个数字是列的数量) 要绘制4D图,使用颜色作为第四维,可以使用 splot '1.txt' using 2:3:4:5 every ::1 palette # | | # | | # used for 3d plots skip the he

如何在Gnuplot中绘制(3D绘图)具有这种数据结构的矩阵, 使用第一行和第一列作为x和y记号(第一行的第一个数字是列的数量)


要绘制4D图,使用颜色作为第四维,可以使用

splot  '1.txt' using 2:3:4:5  every ::1  palette
#  |                              |
#  |                              |
# used for 3d plots            skip the header line
或者你想画一幅不同的画,x和y是第一列和第一行,矩阵中的数字只是代表z?然后使用以下命令:

splot '1.txt' every ::1:1 matrix
要添加一些效果,可以将其更改为

set dgrid3d 4,4
splot '1.txt' every ::1:1 matrix with lines

正是这种数据格式可以通过
矩阵非均匀性读入

set view 50,20
set ticslevel 0
splot 'data.txt' matrix nonuniform with lines t ''
这将生成正确的TIC,如数据文件中指定的:


非常感谢!最后一个解决方案“setdgrid3d 4,4;splot'1.txt'every::1:1矩阵加行”对我来说很好。只有我想在图表的底部使用x记号“0.50.60.70.8”和y记号“1 2 3 4”。有可能吗?@micheletuttafesta:你可以使用
setxtics(0.5,0.6,0.7,0.8)
。好了,gnuplot没有menas来从输入文件中获取数字,因此您必须生成gnuplot脚本:
head-n1 input.txt | sed的//,/g;s/^/set xtics(/;s/$/)/'>script.gp
。谢谢choroba!您的建议是我的最终解决方案。实际上,
gnuplot
有一个命令可以准确地读取此数据格式,并且它也使用了正确的tics,请参阅我的答案。
set view 50,20
set ticslevel 0
splot 'data.txt' matrix nonuniform with lines t ''