7
如何绘制(三维图)Gnuplot中具有此类数据结构的矩阵, 将第一行和第一列用作ax和y ticks(第一行的第一个数字是列数)?gnuplot:数据矩阵的三维图
4 0.5 0.6 0.7 0.8
1 -6.20 -6.35 -6.59 -6.02
2 -6.39 -6.52 -6.31 -6.00
3 -6.36 -6.48 -6.15 -5.90
4 -5.79 -5.91 -5.87 -5.46
如何绘制(三维图)Gnuplot中具有此类数据结构的矩阵, 将第一行和第一列用作ax和y ticks(第一行的第一个数字是列数)?gnuplot:数据矩阵的三维图
4 0.5 0.6 0.7 0.8
1 -6.20 -6.35 -6.59 -6.02
2 -6.39 -6.52 -6.31 -6.00
3 -6.36 -6.48 -6.15 -5.90
4 -5.79 -5.91 -5.87 -5.46
正是这种数据格式可以与matrix nonuniform
被阅读:
set view 50,20
set ticslevel 0
splot 'data.txt' matrix nonuniform with lines t ''
这将产生正确的抽动,就像数据文件中指定的那样:
要绘制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 dgrid3d 4,4; splot'1.txt'every :: 1:1 matrix with lines”对我很好。只有我想在图的底部使用x个刻度“0.5 0.6 0.7 0.8”并且y勾选“1 2 3 4”。可能吗? – micheletuttafesta
@micheletuttafesta:你可以使用'set xtics(0.5,0.6,0.7,0.8)'。 AFAIK,gnuplot没有从输入文件中获取数字的菜单,所以你必须生成gnuplot脚本:'head -n1 input.txt | sed's//,/ g; s/^/set xtics(/; s/$ /)/'> script.gp'。 – choroba
谢谢choroba!你的建议是我的最终解决方案 – micheletuttafesta