How to use a MeshFunctions in ListDensityPlot[ ] ?

Hello Guys.

I plotted the data composed of many (x,y,z) points with ListDensityPlot and the graph looks nice with a good resolution. Here the value z ranges from 10 to 20 (for example).
I wanted to draw Meshes for z = 10, 12, 14, 16, 18, 20.
But when I used Mesh = 6, it is ok that the number of lines are 6, but the interval between succesive lines are not 2, nor equal interval.
It can be very easy for you. But I couldn’t find a solution for hours.
Would you help me…?
Thank you in advance.

And the code and data files are attached.

Best regards,
Jiwan

Post1.nb (503 KB)
Test.txt (775 KB)

Hi Jiwan,

It would help if you could edit your question and add the code you are using and attach a sample of the data.

Take a look at the documentation for MeshFunctions under the Options section for ListDensityPlot.

Thanks for providing the code and data. Is this is what you are looking for? Not sure why there are more than 6 contour lines though

data = HeffTempStr[[All, {1, 2, 4}]];
ListDensityPlot[data,
 PlotLegends -> Automatic,
 AxesStyle -> Directive[Black, Thick],
 LabelStyle -> Directive[Black, Large, FontFamily -> "Helvetica"],
 ColorFunction -> "BlueGreenYellow",
 FrameTicks -> {{{10, 20, 30, 40, 50, 60}, None}, {{400, 500, 600}, None}},
 Mesh -> {10, 12, 14, 16, 18, 20},
 MeshFunctions -> {#3 &}]

Maybe ListContourPlot is a better option? If you hover over a contour line the corresponding z value is shown as a tooltip.

ListContourPlot[data,
 PlotLegends -> Automatic,
 AxesStyle -> Directive[Black, Thick],
 LabelStyle -> Directive[Black, Large, FontFamily -> "Helvetica"],
 ColorFunction -> "BlueGreenYellow",
 FrameTicks -> {{{10, 20, 30, 40, 50, 60}, None}, {{400, 500, 600}, None}},
 Contours -> {10, 12, 14, 16, 18, 20, 25}]

ListDensityPlot with 6 contour lines:

data = HeffTempStr[[All, {1, 2, 4}]];

ListDensityPlot[
 	data, 
    PlotLegends -> Automatic, AxesStyle -> Directive[Black, Thick],
 	LabelStyle -> Directive[Black, Large, FontFamily -> "Helvetica"],
 	ColorFunction -> "BlueGreenYellow",
 	FrameTicks -> {{{10, 20, 30, 40, 50, 60}, None}, {{400, 500, 600}, None}},
 	Mesh -> 6, MeshFunctions -> {#3 &}
 ]

When I use Mesh → {{10,12,14,16,18}}, it works.
It’s simple grammar. -_-a
Thank you very much!
Best regards,
Jiwan.

Thank you all and I am sorry for the late reply.
I had the same problem, Rohit Namjoshi. When I used Mesh → {10,12,14,16,18}, there generated many lines. That’s why I asked the help.

Thank you Hans Milton for the suggestion.
I already tried ListContourPlot first. But the colour resolution was not good. That’s why I tried to use ListDensityPlot. -_-a

I am still trying to find the answer…