Skip to main content
2 of 9
added 660 characters in body
kglr
  • 400.5k
  • 18
  • 488
  • 929
cp = ContourPlot[Sin[x - y] + Cos[x + y], {x, -10, 10}, {y, -10, 10}, 
  PlotPoints -> {30, 30}, PlotRange -> {{-10, 10}, {-10, 10}}, 
  ColorFunction -> "Rainbow", ImageSize -> 500, 
  Axes -> True]; 

Replace[cp, {Tooltip[{d___, l__Line}, t : (0. | 1. | -1.)] :> {Thick, Opacity[1], 
    t /. {0. -> Green, -1. -> Red, 1. -> Blue, _ -> {d}},  Tooltip[{l}, t]}}, All]

enter image description here

Alternatively, extract the contours from cp and redo ContourPlot using styled contours:

contours = Cases[cp, Tooltip[_, t_] :> t, All];

styledcontours = Join[ {#, Directive[##2]} & @@@ 
    Thread[{{0., -1., 1.}, {Green, Red, Blue}, Thick, Opacity[1]}], 
   Complement[contours, {0., -1., 1.}]];

ContourPlot[Sin[x - y] + Cos[x + y], {x, -10, 10}, {y, -10, 10}, 
 PlotPoints -> {30, 30}, PlotRange -> {{-10, 10}, {-10, 10}}, 
 ColorFunction -> "Rainbow", ImageSize -> 500, Axes -> True, 
 Contours -> styledcontours]

enter image description here

kglr
  • 400.5k
  • 18
  • 488
  • 929