Q: Gnuplot plot 3D data on xy graph with contours I try to plot 3D data on a xy plane graph with contours. I manage to get the color map but I have few issues.
My data are in 3 columns (see code below) with space between each row.
0.000000000 0.897777778 0.000000000  
0.000000000 0.906666667 0.000000000  
0.000000000 0.915555556 0.000000000  
0.000000000 0.924444444 0.000000000  
0.000000000 0.933333333 0.000000000  
0.000000000 0.942222222 0.000000000  
0.000000000 0.951111111 0.000000000  
0.000000000 0.960000000 0.000000000  
0.000000000 0.968888889 0.000000000  
0.000000000 0.977777778 0.000000000  
0.000000000 0.986666667 0.000000000  
0.000000000 0.995555556 0.000000000  

0.111111111 0.453837597 0.008893913  
0.111111111 0.462736374 0.009285188  
0.111111111 0.471635150 0.009686812  
0.111111111 0.480533927 0.010098938  
0.111111111 0.489432703 0.010521720  
0.111111111 0.498331479 0.010955318  
0.111111111 0.507230256 0.011399894  
0.111111111 0.516129032 0.011855617  

My code is the following:
set terminal postscript eps color enhanced "Helvetica" 14
set output 'phiCH_TpFR.eps'
set contour base
set style textbox opaque noborder
unset surface
set style textbox opaque noborder
set cntrparam level discrete 0.5,1,1.5,2,2.5,3
set cntrparam bspline
set isosamples 250, 250
set view map
set xrange [0:10]
set yrange [0.55:0.95]
set cbrange [0:4]
set dgrid3d 50,50,50 gauss .005, .035

set table "contour_CH.txt"
splot "data_sensibilite_correlation_Tpfr_CH"
unset table

unset contour
set surface
set table "dgrid_CH.txt"
splot "data_sensibilite_correlation_Tpfr_CH"
unset table

reset
set pm3d map
unset key
set xrange [0:10]
set yrange [0.55:0.95]
set cbrange [0:4]
set xlabel "{/Symbol e}_{/Symbol q} [%]"
set ylabel "T_b / T_{w hs}"
set cblabel "{/Symbol e}_{{/Symbol F} hs} [%]"
splot 'dgrid_CH.txt' w pm3d, 'contour_CH.txt' w l lc rgb "black", 'contour_CH.txt' every 10 w labels

And I get the following graph:

My issues are the following:

*

*I did not manage to get the labels of the contour plot. What can I do to solve this ? I notice that in the file "contour_CH.txt" not all the contours have labels. I do not know if this is the cause of my problem.
# Contour 1, label:      2.5
7.29125  0.900642  2.5
7.26953  0.901372  2.5
7.24415  0.902123  2.5
7.21428  0.902917  2.5
7.18137  0.903743  2.5
7.14745  0.904582  2.5
7.11456  0.905415  2.5
7.08473  0.906223  2.5
7.05941  0.906997  2.5
7.03775  0.907755  2.5
7.0183  0.908527  2.5
6.99961  0.909341  2.5
....
# Contour 2, label:
9.88889  0.816038  2.5
9.80771  0.818407  2.5
9.75248  0.820019  2.5
....


*There is a white space between my axis and the color map. I do not understand why since my data are wider than the plot range.
Thank you in advance for your answer,
Martin

A: If you check help contour, it will tell you that contour is only available for splot. However, you can splot the data into a table and use this contour table for plot. The first block (separated by two empty lines) of $Contour contains the data and the following block contains the contour line data separated by single empty lines. You can address the latter via index 1::1.
I would try something like this as a starting point, certainly room for improvements: (tested with gnuplot 5.0.0 and 5.2.8). Apparently, your data is skewed.
Code:
### plot heatmap with contour lines
reset session

FILE = "Martin7data.dat"

set contour
set cntrparam level discrete 0.5, 1, 1.5, 2, 2.5, 3
set table $Contour
    splot FILE u 1:2:3
unset table

set style textbox opaque
unset key

set view
plot FILE u 1:2:3 w image, \
     $Contour u 1:2 index 1::1 w l lc "red", \
     '' u 1:2:3 index 1::1 every ::0::0 w labels boxed
### end of code

Result:

