Re: ContourPlot problem

• To: mathgroup at smc.vnet.net
• Subject: [mg90085] Re: ContourPlot problem
• Date: Sat, 28 Jun 2008 05:53:11 -0400 (EDT)
• References: <g42ere\$no5\$1@smc.vnet.net>

```Jorge Cortes wrote:
> Hello,
>
>   I've noticed the following problem with ContourPlot (I'm using
> Mathematica 6..0.3) and a simple exponential function.
>
>  If you try the domain {x,-3,3}, {y,-3,3}
>
> ContourPlot[Exp[-x^2 - 2 y^2], {x, -3,3}, {y, -3, 3},
>  Contours -> {.1,.2, .3, .4, .5, .6, .7, .8, .9, 1},
>  ContourLabels -> True, ContourShading -> False]
>
>   you only get one contour (the one corresponding to .1). However, if
> you shrink the domain to {x,-2,2}, {y,-2,2}, surprisingly you get all
> the contours (?)
>
> ContourPlot[Exp[-x^2 - 2 y^2], {x, -2,2}, {y, -2, 2},
>  Contours -> {.1,.2, .3, .4, .5, .6, .7, .8, .9, 1},
>  ContourLabels -> True, ContourShading -> False]
>
>   Does anybody has an explanation for this? Thanks!

I have found ContourPlot to be a little squirrelly in its choice of
PlotRange. Your example does work if you set the PlotRange explicitly.

ContourPlot[Exp[-x^2 - 2 y^2], {x, -3, 3}, {y, -3, 3},
Contours -> {.1, .2, .3, .4, .5, .6, .7, .8, .9, 1},
ContourLabels -> True, ContourShading -> False, PlotRange -> 3]

--