0
votes

I want to plot some data points (M_Coord_Plain.txt) onto a 2D contour projection (which is made by data on Contours.txt).

I have found similar answers on these posts: How to mark some points on 2D heat map in gnuplot?, Overlaying points onto a pm3d map? , but unfortunately these don't seem to work in my case.

First i set the options:

set pm3d explicit   
unset surface     # Switch off the surface    
set view map      # Set a bird eye (xy plane) view    
set contour       # Plot contour lines    
set key outside    
set cntrparam cubicspline   # smooth out the lines    
unset colorbox

and then i plot with the splot command:

splot 'Contours.txt' using 1:2:3 notitle with pm3d,\
      'M_Coord_Plain.txt' with points nocontour using 1:2:(0) pt 7

The resulted plot is only the contour 2D projection but with no points on it and with no errors.

1

1 Answers

0
votes

Finally it worked, but the following changes had to be made:

  1. Include a space between each line in the data file of points (M_Coord_Plain.txt) because the splot command needs this format.
  2. Delete the unset surface command and replace it with set surface command because the data points are plotted on the surface. However this has as a result the points to seem vague since the corresponding color for zero value (the defined third column :(0) ) is by default dark purple.
  3. So we can use a black and white color palette and define a wide range colorbox range in order to have a big contrast between zero and high contour values.

So the commands to plot the requested plot are:

set pm3d explicit
set surface
set view map  # Set a bird eye (xy plane) view
set contour  # Plot contour lines
set key outside
set cntrparam cubicspline  # Smooth out the lines
set cntrparam levels discrete 3.197,3.552  # Plot the selected contours
unset colorbox
set cbrange [0:7000]  # Set the color range of contour values.
set palette model RGB defined ( 0 'white', 1 'black' )
set style line 1 lc rgb '#4169E1' pt 7 ps 2
splot 'Contours.txt' using 1:2:3 with pm3d notitle,\
      'M_Coord_Plain.txt' using 1:2:(0) with points ls 1 notitle

The resulted plot is this.