Message Boards Message Boards

0
|
3113 Views
|
5 Replies
|
0 Total Likes
View groups...
Share
Share this post:

How to use a MeshFunctions in ListDensityPlot[ ] ?

Posted 2 years ago

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

Attachments:
POSTED BY: hwoarang Polar
5 Replies
Posted 2 years ago

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....

POSTED BY: hwoarang Polar
Posted 2 years ago

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 &}
 ]

enter image description here

POSTED BY: Hans Milton
Posted 2 years ago

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 &}]

enter image description here

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}]

enter image description here

POSTED BY: Rohit Namjoshi
Posted 2 years ago

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.

POSTED BY: Rohit Namjoshi
Posted 2 years ago

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

POSTED BY: hwoarang Polar
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract