1

I have two plot a heatmap and a contour plot from the same data. I want to over plot them in such a way. I post it the two plots headmap and contour. I try to follow this page Splot (contour, view map) and plot on same graph but I can not be able to realize anything good. Then I add the two file.plt I wrote to obtain this two.

The first one for the heatmap:

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

And the one for the contour:

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

There is some way to overplot them? I also attach the elimnatedFinal.dat file http://speedy.sh/tAhk3/elimnatedFinal.dat

Thanks really a lot to all of you!

1 Answer 1

4

You need to plot the contours to a "table" (meaning another file) so that you have a set of y(x) curves that can be plotted on top of the heap map:

# 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

Result:

enter image description here

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.