gnuplot 热图 z 值数据与颜色条范围不匹配

问题描述 投票:0回答:1

我正在从包含 x、y、z 列的文件创建热图。我得到的热图似乎是数据中峰值的正确位置,但是,峰值约为数据中 z 值的 1/10。

我尝试使用 set cbrange 来更改颜色条范围,但这只会导致峰值被冲掉的绘图。

以下分别是我的数据格式、代码和输出图像:

数据格式(数据有 200 X 200 个元素):

   1.665      -0.031       0.355
   1.634      -0.031       0.395
   1.602      -0.031       0.434
   1.571      -0.031       0.471
   1.539      -0.031       0.505
   1.508      -0.031       0.533
   1.477      -0.031       0.555
   1.445      -0.031       0.568
   1.414      -0.031       0.571
   1.382      -0.031       0.563
   1.351      -0.031       0.546

代码:

set view map
set dgrid3 200,200,1
set xrange [-3.14:3.14]
set yrange [-3.14:3.14]
set termoption enhanced
set xlabel '{/Symbol f}_{i + 1}'
set ylabel '{/Symbol y}_{i}' off -3,0
set size square
set palette defined (0 0 0 0.5, 1 0 0 1, 2 0 0.5 1, 3 0 1 1, 4 0.5 1 0.5, 5 1 1 0, 6 1 0.5 0, 7 1 0 0, 8 0.5 0 0)
splot "plot-pmf-out4.dat" using 1:2:3 with pm3d
set terminal postscript eps enhanced
set output "pmf-plot4.eps"
replot

resulting image after calling gnuplot

gnuplot
1个回答
0
投票

这是对我的问题的比我在评论中给出的更详细的答案。我最终用来获取 2D 和 3D 绘图的代码是:

2D(热图):

set view map
set xrange [-3.14:3.14]
set yrange [-3.14:3.14]
set termoption enhanced
set xlabel '{/Symbol f}_{i + 1}' font ",24" off 0,-1
set ylabel '{/Symbol y}_{i}' font ",24" off -3,0
set palette defined (0 0 0 0.5, 1 0 0 1, 2 0 0.5 1, 3 0 1 1, 4 0.5 1 0.5, 5 1 1 0, 6 1 0.5 0, 7 1 0 0, 8 0.5 0 0)
set size square
splot "plot-pmf-out4.dat" using 1:2:3 with points palette pointsize 0.9 pointtype 5 notitle
set terminal postscript eps enhanced
set output "map.eps"
replot

3D(曲面图):

set xrange [-3.14:3.14]
set yrange [-3.14:3.14]
set termoption enhanced
set xlabel '{/Symbol f}_{i + 1}' font ",24"
set ylabel '{/Symbol y}_{i}' font ",24"
set palette defined (0 0 0 0.5, 1 0 0 1, 2 0 0.5 1, 3 0 1 1, 4 0.5 1 0.5, 5 1 1 0, 6 1 0.5 0, 7 1 0 0, 8 0.5 0 0)
set hidden3d
set xyplane 0
set size square
splot "plot-pmf-out4.dat" using 1:2:3 with points palette pointsize 0.4 pointtype 7 notitle
set terminal postscript eps enhanced
set output "surf.eps"
replot

输入数据为“plot-pmf-out4.dat”。数据由 3 列 x、y 和 z 组成,其中 y 列变化最快。请参阅链接:

psy.swansea.ac.uk/staff/carter/gnuplot/gnuplot_3d.htm

了解更多详情。这是最终的情节:

heatmapsurface plot

© www.soinside.com 2019 - 2024. All rights reserved.