'Trying to plot contours on Mac using the same script I use on windows on gnuplot

I have an issue with gnuplot on Mac. On windows everything seems fine I can easily draw contours on a "heat map". But on my Mac using the same script I can plot the map but not the contours on top of it.

https://imgur.com/a/x00bFnJ here is the two images. One with the contours is on Windows, other one is on Mac.

https://justpaste.it/6ws4h and here is the script.

I tried grid3d but they seem like not nearly accurate as the ones I have plotted on windows.



Solution 1:[1]

Well! I will answer my own question.

set pm3d map 
set contour surface 
set cntrparam ... 
sp "DATA" u 1:2:3  with pm3d lw 2,"" u 1:2:3 with lines nosurf

Solved my problem.!

Solution 2:[2]

I cannot explain the difference between your two machines, but I think I can see where the problem arises. The following lines from your script are inconsistent with producing a plot with both a surface and contours shown:

set style data pm3d
set style function pm3d
set pm3d explicit at b
splot DATA with pm3d        # command simplified

The issue is that both the default style and the explicit plot command specify pm3d, which is a filled-area surface plot. But contours need to be drawn with lines or with labels. You need some combination of defaults and explicit styles that allows you to mix both a surface and lines. I think either of these would do the trick:

set pm3d explicit
set style data lines
splot DATA with pm3d

or

set pm3d implicit
splot DATA with lines

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 DoubleOreo
Solution 2 Ethan