gnuplot:数据矩阵的2D图 [英] gnuplot: 2D plot of a matrix of data

查看:76
本文介绍了gnuplot:数据矩阵的2D图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

How can I plot (a 2D plot) a matrix in Gnuplot having such data structure, using the first row and column as a x and y ticks (the first number of the first row is the number of columns) and represent the rest of the values by a colour mapping so it can be seen on a 2D plane ?

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

You can plot this data format using matrix nonuniform.

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

To get a heatmap you can plot either with image (regular grid, no interpolation, one quadrangle for each data point), or splot with pm3d (supports also irregular grids and interpolation, plots one quadrangle for four neighboring data points.

  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

这篇关于gnuplot:数据矩阵的2D图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆