Gnuplot,热图,标记某一点

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

我正在尝试绘制热图并完成绘图。虽然我需要用某些名称标签来标记某些点。我使用了命令标签,但它不起作用。我查了但是我没有得到任何有效的解决方案。提前致谢。

我正在添加我用来生成的基本脚本。

set terminal postscript portrait enhanced color size 16cm,12cm
set output "pdiff.pdf"
set style data lines
set pm3d


set xlabel "Baseline  in km" 
set ylabel "Energy  in GeV"

set view map scale 1
unset surf
set cbrange [-0.04:0.05]
set xrange [200:1500]
set yrange [0.2:5]
set xtics 100,200,1500
set ytics 0,0.5,5

set label "DUNE" at 1300,2.521 point pt 28 ps 1   
set label "NOvA" at 812,1.574 point pt 22 ps 1
set label "KD" at 1100,2.133 point pt 20 ps 1
set pm3d interpolate 5,7
set palette defined ( 0 0.05 0.05 0.2, 0.1 0 0 1, 0.25 0.7 0.85 0.9,\
     0.4 0 0.75 0, 0.5 1 1 0, 0.7 1 0 0, 0.9 0.6 0.6 0.6,\
     1 0.95 0.95 0.95 )
splot "pdiff.txt" using 1:2:3 notitle with labels
label gnuplot
1个回答
0
投票

这里有两个问题。

  1. 您需要与标签分开绘制pm3d曲面
  2. “带标签的splot”需要4列信息:x,y,z,label

假设数据文件中的列实际上是x,y,z,label尝试:

splot "pdiff.txt" using 1:2:3 with pm3d, \
      "pdiff.txt" using 1:2:3:4 with labels

您应该对未从文件中提取的标签进行编号,以便您可以单独引用它们。此外,由于您使用3D命令splot,您应该为标签指定x,y和z坐标。要将单个标签移到前面(在其他所有内容后绘制),请添加关键字front,如下所示

set label 1 "DUNE" at 1300, 2.521, 0.0 point pt 28 ps 1
set label 1 front
set label 2 "NOvA" at 812, 1.574, 0.0 point pt 22 ps 1
set label 2 front
© www.soinside.com 2019 - 2024. All rights reserved.