Skip to main content
added 111 characters in body
Source Link
kglr
  • 400.5k
  • 18
  • 488
  • 929
contoursautomaticcontours = DeleteDuplicatesBy[First]@FindDivisions[{-2, 2}, 10];

styledcontours = Join[{{-1, Directive[Thick, Red]}, 
   {0, Directive[Thick, Green]},
        {1, Directive[Thick, Blue]}}, ;

contours = DeleteDuplicatesBy[First]@
 Thread[{FindDivisions[{-2, 2}, 10]Join[styledcontours, Thread[{automaticcontours, Automatic}]];

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, 
 Contours -> contours]
contoursautomaticcontours = Cases[cp, Tooltip[_, t_] :> t, All]
{1.5, 1., 0.5, 0., -0.5, -1., -1.5};
styledcontours = Join[ Thread[{{0., -1., 1.}, 
     Thread[Directive[{Green, Red, Blue}, Thick, Opacity[1]]]}], ];

contours = Join[styledcontours Complement[contours, Complement[automaticcontours, {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, 
 Contours -> styledcontours]contours]
contours = DeleteDuplicatesBy[First]@
  Join[{{-1, Directive[Thick, Red]}, {0, Directive[Thick, Green]},
        {1, Directive[Thick, Blue]}}, 
   Thread[{FindDivisions[{-2, 2}, 10] , Automatic}]];

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, 
 Contours -> contours]
contours = Cases[cp, Tooltip[_, t_] :> t, All]
{1.5, 1., 0.5, 0., -0.5, -1., -1.5}
styledcontours = Join[ Thread[{{0., -1., 1.}, 
     Thread[Directive[{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, 
 Contours -> styledcontours]
automaticcontours = FindDivisions[{-2, 2}, 10];

styledcontours = {{-1, Directive[Thick, Red]}, 
   {0, Directive[Thick, Green]}, {1, Directive[Thick, Blue]}};

contours = DeleteDuplicatesBy[First]@
   Join[styledcontours, Thread[{automaticcontours, Automatic}]];

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, 
 Contours -> contours]
automaticcontours = Cases[cp, Tooltip[_, t_] :> t, All]
{1.5, 1., 0.5, 0., -0.5, -1., -1.5};
styledcontours = Thread[{{0., -1., 1.}, 
     Thread[Directive[{Green, Red, Blue}, Thick, Opacity[1]]]}];

contours = Join[styledcontours , Complement[automaticcontours, {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, 
 Contours -> contours]
added 51 characters in body
Source Link
kglr
  • 400.5k
  • 18
  • 488
  • 929

ContourPlot

Hope one ofAll the four methods below work in Version 7.0.add three styled curves, "while all other curves stay in the default style."

ContourPlot

ContourPlot

Hope one of the four methods below work in Version 7.0.

All the methods below add three styled curves, "while all other curves stay in the default style."

ContourPlot

added 977 characters in body
Source Link
kglr
  • 400.5k
  • 18
  • 488
  • 929

1. Use FindDivisions to generate a mesh list (that matches the automatically generated one) and add your list of styled mesh lines and use the combined list as the setting for Mesh:

automaticmeshlines = Most @ Rest @ FindDivisions[{-2, 2}, 18];

styledmeshlines = {{-1, Directive[Thick, Red]}, {0, 
    Directive[Thick, Green]}, {1, Directive[Thick, Blue]}};

mesh = DeleteDuplicatesBy[First]@
  Join[styledmeshlines, Thread[{automaticmeshlines , Automatic}]];

Plot3D[Sin[x - y] + Cos[x + y], {x, -10, 10}, {y, -10, 10}, 
 PlotPoints -> {30, 30}, PlotRange -> {{-10, 10}, {-10, 10}, {-3, 3}},
 ColorFunction -> "Rainbow", ImageSize -> 500, 
 Method -> {"RotationControl" -> "Globe"}, SphericalRegion -> True,
 MeshFunctions -> {#3 &},
 Mesh -> {mesh}]

enter image description here

2. Add constant functions in the first argument of Plot3D corresponding to the desired levels, set their PlotStyle to Opacity[0] and use the option BoundaryStyle to set the directives for the intersection of the main surface with the added planes:

23. Post-process to restyle selected mesh lines:

1. Add constant functions in the first argument of Plot3D corresponding to the desired levels, set their PlotStyle to Opacity[0] and use the option BoundaryStyle to set the directives for the intersection of the main surface with the added planes:

2. Post-process to restyle selected mesh lines:

1. Use FindDivisions to generate a mesh list (that matches the automatically generated one) and add your list of styled mesh lines and use the combined list as the setting for Mesh:

automaticmeshlines = Most @ Rest @ FindDivisions[{-2, 2}, 18];

styledmeshlines = {{-1, Directive[Thick, Red]}, {0, 
    Directive[Thick, Green]}, {1, Directive[Thick, Blue]}};

mesh = DeleteDuplicatesBy[First]@
  Join[styledmeshlines, Thread[{automaticmeshlines , Automatic}]];

Plot3D[Sin[x - y] + Cos[x + y], {x, -10, 10}, {y, -10, 10}, 
 PlotPoints -> {30, 30}, PlotRange -> {{-10, 10}, {-10, 10}, {-3, 3}},
 ColorFunction -> "Rainbow", ImageSize -> 500, 
 Method -> {"RotationControl" -> "Globe"}, SphericalRegion -> True,
 MeshFunctions -> {#3 &},
 Mesh -> {mesh}]

enter image description here

2. Add constant functions in the first argument of Plot3D corresponding to the desired levels, set their PlotStyle to Opacity[0] and use the option BoundaryStyle to set the directives for the intersection of the main surface with the added planes:

3. Post-process to restyle selected mesh lines:

added 624 characters in body
Source Link
kglr
  • 400.5k
  • 18
  • 488
  • 929
Loading
added 1088 characters in body
Source Link
kglr
  • 400.5k
  • 18
  • 488
  • 929
Loading
added 669 characters in body
Source Link
kglr
  • 400.5k
  • 18
  • 488
  • 929
Loading
added 689 characters in body
Source Link
kglr
  • 400.5k
  • 18
  • 488
  • 929
Loading
Post Undeleted by kglr
Post Deleted by kglr
added 660 characters in body
Source Link
kglr
  • 400.5k
  • 18
  • 488
  • 929
Loading
Source Link
kglr
  • 400.5k
  • 18
  • 488
  • 929
Loading