Gnuplot: how to write the z values in a heatmap plot

故事扮演 提交于 2019-12-07 19:32:36

问题


I am using Gnuplot 4.6.5

I want to write the z value in a heatmap plot.

Here is the code for producing the heatmap:

#
# Two ways of generating a 2D heat map from ascii data
#

set title "Heat Map generated from a file containing Z values only"
unset key
set tic scale 0

# Color runs from white to green
set palette rgbformula -7,2,-7
set cbrange [0:5]
set cblabel "Score"
unset cbtics

set xrange [-0.5:1.5]
set yrange [-0.5:1.5]

set view map
plot '-' using 1:2:3 with image
0 0 5
0 1 4

1 0 2
1 1 2
e

This gives:

I want to write the z values in the figure:

My actually data is much larger than the demonstration data used here. So it is almost impractical to write each point manually.

Any help would be appreciated.


回答1:


You can use the labels plotting style for this. See also gnuplot matrix or plot : display both color and point value for a very similar question:

unset key
set palette rgbformula -7,2,-7
set cbrange [0:5]
set cblabel "Score"
unset cbtics
set autoscale fix

plot '-' using 1:2:3 with image, \
     '-' using 1:2:(strcol(3)) with labels
0 0 5
0 1 4

1 0 2
1 1 2
e
0 0 5
0 1 4

1 0 2
1 1 2
e



来源:https://stackoverflow.com/questions/25164589/gnuplot-how-to-write-the-z-values-in-a-heatmap-plot

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!