7
$\begingroup$

I have a list of data as .dat file in my dropbox.

And I have plot with ListContourPlot by this way:

j132 = Import["paraloop_8.dat"];
lista131 = 
  Table[{j132[[i, 1]], j132[[i, 2]], j132[[i, 8]]}, {i, 1, 
    Length[j132]}];

newStyle[x_] := x /. l_Line :> Sequence[Opacity[1], Thick, Red, l]

ListContourPlot[lista131, Contours -> 50, PlotLegends -> Automatic, 
  FrameStyle -> FontSize -> 14, ImageSize -> 350] /. 
 Tooltip[x_, 0] :> Tooltip[newStyle[x], 0]

This way I can color with red the contour with value equal zero, but, if I want colorize the contour with another value, for exemple, 0.018 I can't. What can be wrong?

$\endgroup$
  • $\begingroup$ 0.018 is not one of the 50 automatically generated contour lines. $\endgroup$ – kglr Sep 12 '18 at 21:32
9
$\begingroup$

You can use MeshFunctions, Mesh and MeshStyle:

mesh ={ 0.18};
ListContourPlot[j132[[All, {1, 2, 8}]], Contours -> 50, 
 PlotLegends -> Automatic, FrameStyle -> FontSize -> 14, 
 ImageSize -> 350, MeshFunctions -> {#3 &}, Mesh -> {mesh}, 
 MeshStyle -> Directive[Opacity[1, Red], Thick]]

enter image description here

Note: An alternative and simpler way to get your lista131 is to use 132[[All, {1, 2, 8}]]:

lista131 == j132[[All, {1, 2, 8}]]

True

With a smaller (Downsampled) version of input data

mesh = {0.018, {.2, Directive[Dashed, Thick, Purple]}};
j132small = Downsample[j132[[All, {1, 2, 8}]], {20, 1}]
ListContourPlot[j132small, Contours -> 50, PlotLegends -> Automatic, 
 FrameStyle -> FontSize -> 14, ImageSize -> 350, 
 MeshFunctions -> {#3 &}, Mesh -> {mesh}, 
 MeshStyle -> Directive[Opacity[1, Red], Thick]]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.