I have a contour plot that took a few hours to evaluate. Is there a way that I can show only the contour lines of a specific value without re-evaluating the contour plot?

  • $\begingroup$ Did you want the shading? The question's been changed to assume that you don't... $\endgroup$
    – cormullion
    Commented Jul 23, 2013 at 17:20

1 Answer 1


Try this:

p = ContourPlot[Im[(x + I y)^(1/2)], {x, -1, 1}, {y, -1, 1}, 
   Contours -> 21, ColorFunction -> Hue];

p /. {___, EdgeForm[___], ___} :> {}



To isolate a contour line of a particular value, you could use Tooltip information in an automated way, but let's assume that you don't have those enabled.

Then how do you extract the desired contour? Here is a manual way that always works as long as you can visually pick out the contour you're interested in:



What I've done above is to display the graphic for the contour plot in a very bare-bones way. Then I double-clicked on the graphic to activate the Drawing Tools. They allow me to select a particular contour by double-clicking again. If you get the contour to be highlighted as above, you should be good to go for the next step:

Copy the highlighted contour the usual way (using Edit menu or shortcut), then type this:

Show[   , Frame -> True, PlotRange -> {{-1, 1}, {-1, 1}}]

Here, paste the copied graphic into the empty space in the first argument of Show.

Now you'll have the contour isolated, in exactly the right position relative to the frame that I re-created above.


For this to work, it's important to convert the contour plot using Normal as I did above, so all objects have the information about their absolute coordinate placement.

  • $\begingroup$ There is just one thing to do... select the lines corresponding to one value only. But that should be possible by the tooltips. Or maybe even a better way? $\endgroup$
    – sebhofer
    Commented Jul 23, 2013 at 16:23
  • $\begingroup$ @sebhofer I forgot that part... Question for the OP: did your original plot contain Tooltps? That would allow you to identify the contour you want. $\endgroup$
    – Jens
    Commented Jul 23, 2013 at 16:26
  • 1
    $\begingroup$ In that case I think one could use p/.Tooltip[_, Except[label]] :> Sequence[] to delete the unwanted lines... $\endgroup$
    – sebhofer
    Commented Jul 23, 2013 at 16:33
  • $\begingroup$ @sebhofer That definitely works, if he has tooltips. I decided to answer in a different way in my edit. $\endgroup$
    – Jens
    Commented Jul 23, 2013 at 16:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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