MathGroup Archive 2011

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

Search the Archive

Color discontinuity with ColorFunction in ContourPlot

  • To: mathgroup at smc.vnet.net
  • Subject: [mg123146] Color discontinuity with ColorFunction in ContourPlot
  • From: Chris Young <cy56 at comcast.net>
  • Date: Thu, 24 Nov 2011 06:59:05 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com

No matter how many contours I put in, I can't get a smooth match up of
colors across the vertical and horizontal axes in the 2D plot of Sin[x
y].

There's a picture at http://home.comcast.net/~cy56/ContourPlot.png and
a Mathematica notebook file at
http://home.comcast.net/~cy56/ContourPlot.nb.


Manipulate[
 Row[
  {
   Show[
    ContourPlot[
     Sin[x y], {x, x0, x1}, {y, y0, y1},
     Contours -> n,
     ColorFunction -> (Hue[0.4 #, 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},
     Contours -> n,
     ColorFunction -> (Hue[0.4 #, 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 &},
    Mesh -> n,
    Lighting -> "Neutral",
    ColorFunction -> (Hue[0.4 #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, 8}, 0, 32, 1},
 {{sat, 0.5}, 0, 1},
 {{bri, 0.5}, 0, 1},
 {{opac, 0.5}, 0, 1}
 ]




  • Prev by Date: Re: What is the point of having Initializations in DynamicModule and Manipulate?
  • Next by Date: Re: Sorting strings
  • Previous by thread: Contours for negative and positive in ContourPlot
  • Next by thread: Non trivial substitution in a very long output