MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Contours for negative and positive in ContourPlot


I got the following to plot different styles of contours for negative 
and positive values, by using RegionPlot to make separate plots.

I suppose I could use a list of contours with style directives 
included. This would be more cumbersome coding, but the current version 
is really slow to respond.

Chris Young
cy56 at comcast.net


Manipulate[
 Row[
  {
   Show[
    ContourPlot[
     Sin[x y], {x, x0, x1}, {y, y0, y1},
     ColorFunction -> (Hue[#, sat, bri] &),
     ContourStyle -> {Directive[Green, Dotted, AbsoluteThickness[thick], 
        Opacity[opac]]},
     RegionFunction -> Function[{x, y}, Sin[x y] > 0]
     ],
    ContourPlot[
     Sin[x y], {x, x0, x1}, {y, y0, y1},
     ColorFunction -> (Hue[#, sat, bri] &),
     ContourStyle -> {Directive[Red, Dotted, AbsoluteThickness[thick], 
        Opacity[opac]]},
     RegionFunction -> Function[{x, y}, Sin[x y] < 0]
     ]
    ],
   
   ContourPlot3D[
    Sin[x y] == z, {x, x0, x1}, {y, y0, y1}, {z, -1, 1},
    BoxRatios -> {x1 - x0, y1 - y0, 2},
    MeshFunctions -> {#3 &},
    Lighting -> "Neutral",
    ColorFunction -> (Hue[#3, sat, bri] &)
    ]
   }
  ],
 
 {{x0, -4}, -4, 4},
 {{x1, 4}, -4, 4},
 
 {{y0, -4}, -4, 4},
 {{y1, 4}, -4, 4},
 
 
 {{thick, 1}, 0.1, 4, 0.1},
 {{n, 4}, 0, 35, 1},
 {{sat, 0.5}, 0, 1},
 {{bri, 0.5}, 0, 1},
 {{opac, 0.5}, 0, 1}
 ]




  • Prev by Date: Re: Piecewise bug in Mathematica 8.01?
  • Next by Date: Re: What is the point of having Initializations in DynamicModule and Manipulate?
  • Previous by thread: Re: Root finding needs higher accuracy
  • Next by thread: Color discontinuity with ColorFunction in ContourPlot