# Getting a specific contour from ListContourPlot [closed]

How can I extract a single contour line of a ListContourPlot?

Below is a minimal example:

ListContourPlot[Table[{x=RandomReal[{-2,2}],y=RandomReal[{-2,2}],Sin[x y]},{1000}]
,Contours->6
,MeshFunctions->{#3&},Mesh->{{0.5}},MeshStyle->Directive[Opacity[1,Red],Thick]
,PlotLegends->Automatic]


I'd like to get the red contour line at z = 0.5 (as an example) of different ListContourPlots and stack them in a new coordinate grid using Show.

## closed as off-topic by march, corey979, José Antonio Díaz Navas, m_goldberg, Henrik SchumacherOct 20 '18 at 7:23

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – march, corey979, José Antonio Díaz Navas, m_goldberg, Henrik Schumacher
If this question can be reworded to fit the rules in the help center, please edit the question.

• Why not use the settings Contours -> {0.5}, ContourShading -> None? – J. M. is away Oct 18 '18 at 15:40
• Works perfectly, thanks. Sometimes, I seem to think too complicated... – DPF Oct 18 '18 at 16:08
• @J.M.iscomputer-less can you post it as an answer, such that this can be flagged as solved by @DPF? – Gladaed Oct 19 '18 at 12:52
• @Glad, not at a computer now, and this is a question that needs a picture as part of the answer. Maybe you or the OP can write one on my behalf? – J. M. is away Oct 19 '18 at 13:08
• @J.M.iscomputer-less did that, any comments? – Gladaed Oct 19 '18 at 13:28

You can use contours and contourStyles to specify thresholds and colors.

contours = {0.2, 0.5, 0.9}
contourStyles = {Red, Green, Blue}
ListContourPlot[
Table[{x = RandomReal[{-2, 2}], y = RandomReal[{-2, 2}],
Sin[x y]}, {1000}],
Contours -> contours,
ContourStyle -> contourStyles,
MeshFunctions -> {#3 &},
PlotLegends -> Automatic]


You could combine them using Show like:

plots = ListContourPlot[
Table[{x = RandomReal[{-2, 2}], y = RandomReal[{-2, 2}],
Sin[x y]}, {1000}],
Contours -> {contours[[#]]},
ContourStyle -> {contourStyles[[#]]},

• Well-done! :) ${}$ – J. M. is away Oct 19 '18 at 13:30