我有两个图表来自相同数据的热图和等高线图。我想以这种方式策划它们。我发布了两个情节 和 。 我试着按照这个页面Splot (contour, view map) and plot on same graph但我无法实现任何好处。 然后我添加了我写的两个file.plt来获取这两个。
热图的第一个:
clear
reset
FILE_IN_1="elimnatedFinal.dat"
set terminal pngcairo size 500,500 enhanced font 'Verdana,10'
set output 'density.png'
set title "\n"
set label 1 "headmap" at graph 0.5,1.15 center
set xlabel ' Tp_2'
set ylabel ' Tp_3'
set cblabel 'amplitude'
set xrange [109:110.1]
set yrange [131.3:131.8]
set cbrange [90:180]
set palette defined ( 0 "green", 1 "blue", 2 "orange", 3 "red" )
unset logscale cb
plot FILE_IN_1 u 1:2:3 w image notitle
轮廓的那个:
reset
clear
set terminal pngcairo size 500,500 enhanced font 'Verdana,10'
set output "gnuplot_contours.png"
set dgrid3d 20,20,20
set cntrparam levels incremental 120,10,180
set contour base
unset surface
set view 0,0
set xlabel ' Tp_2'
set ylabel ' Tp_3'
set format z ""
set title "contour"
splot "elimnatedFinal.dat" with lines notitle
有一些方法可以过度绘制它们吗?我还附上了elimnatedFinal.dat文件http://speedy.sh/tAhk3/elimnatedFinal.dat
非常感谢大家!
答案 0 :(得分:4)
您需要将轮廓绘制到"表" (意思是另一个文件),这样你就可以在堆映射的顶部绘制一组y(x)曲线:
# Plot contours to table "contours.dat"
set dgrid3d 20,20,20
set contour base
set view 0,0
unset surface
set cntrparam levels incremental 120,10,180
set table "contours.dat"
splot "elimnatedFinal.dat" with lines notitle
unset table
reset
# Now plot heat map and contours on top
set xrange [109:110.1]
set yrange [131.3:131.8]
set cbrange [90:180]
set palette defined ( 0 "green", 1 "blue", 2 "orange", 3 "red" )
plot "elimnatedFinal.dat" u 1:2:3 w image not, "contours.dat" u 1:2 w l lc 0
结果: