MathGroup Archive 2005

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

Search the Archive

Re: Does ContourPlot behave correctly?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg59879] Re: Does ContourPlot behave correctly?
  • From: Bill Rowe <readnewsciv at earthlink.net>
  • Date: Wed, 24 Aug 2005 06:32:11 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

On 8/23/05 at 4:51 AM, kazimir04 at yahoo.co.uk (Vladislav) wrote:

>I try two commands, the only difference being .9 in lieu of .5 in
>the Contours option.

>ContourPlot[Exp[-(x^2 +
>    y^2)/2], {x, -1, 1}, {y, -1, 1},
>      Contours -> {.39, .5, .95},
>      ColorFunction -> (
>      GrayLevel[#1] &), PlotPoints -> 100];

>ContourPlot[Exp[-(x^2 +
>    y^2)/2], {x, -1, 1}, {y, -1, 1},
>      Contours -> {.39, .9, .95},
>      ColorFunction -> (GrayLevel[#1] &),
>      PlotPoints -> 100];

>I obtain two different plots. The smallest circle is the same for
>the two pictures, it is OK becouse it corresponds to the Contor at
>0.95.

>I expected to have 3 circle on the two pictures with the only
>difference in the second circle at .9 or .5. In reallity, I have
>only two circles in the first plot and three circles in the second
>one. Moreover the external contour at .39 is not the same in the
>two pictures.

>Can anybody explain or justify this behavoir?

Yes, Mathematica is doing exactly what you asked.

In the first plot you have three regions, an inner circle corresponding to areas where the expression is .95 or greater, a gray region corresponding to areas were the expression is between .5 and .95 and a dark region corresponding to areas where the expression is less than .5.

In the second plot you have regions corresponding to .95 (inner circle), .9 to .95 (inner ring), .39 to .9 (large gray area) and <.39 (small dark areas in corners).

That is the large gray area in the two plots does not correspond to the same levels in each. Using ColorFunction->GrayLevel[#1]& doesn't result in clearly distinct colors, making it easy to think the gray areas in both plots correspond to the same set of contours when they don't.

Try using GraphicsArray to display both plots side by side and it will be more apparent there is a difference in the colors of each large gray area. Also, compare

ContourPlot[Exp[-(x^2 +
    y^2)/2], {x, -1, 1}, {y, -1, 1},
      Contours -> {.39, .5, .9, .95},
      ColorFunction -> (GrayLevel[#1] &),
      PlotPoints -> 100];

with the two plots above and see if this doesn't make it clearer.

Or, try evaluating the expression at specific instances of {x,y} and see if that makes things clearer.
--
To reply via email subtract one hundred and four


  • Prev by Date: Re: Does ContourPlot behave correctly?
  • Next by Date: Re: Weird Plot problem
  • Previous by thread: Re: Does ContourPlot behave correctly?
  • Next by thread: Re: Does ContourPlot behave correctly?