gnuplot:数据矩阵的二维图

gnuplot: 2D plot of a matrix of data

我如何在 Gnuplot 中绘制(二维图)具有这种数据结构的矩阵,使用第一行和第一列作为 x 和 y 刻度(第一行的第一个数字是列数)并表示其余值通过颜色映射,以便可以在 2D 平面上看到?

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 绘制此数据格式。

要获得热图,您可以绘制 with image(规则网格,无插值,每个数据点一个四边形),或绘制 with pm3d(也支持不规则网格和插值,绘制一个四个相邻数据点的四边形。

  1. with image

    set autoscale xfix
    set autoscale yfix
    set autoscale cbfix
    plot 'data.dat' matrix nonuniform with image notitle
    

  1. pm3d

    set autoscale xfix
    set autoscale yfix
    set autoscale cbfix
    set pm3d map
    splot 'data.dat' matrix nonuniform notitle