       Re: Re: Extracting contour values from ContourPlot

• To: mathgroup at smc.vnet.net
• Subject: [mg100909] Re: [mg100869] Re: Extracting contour values from ContourPlot
• From: "David Park" <djmpark at comcast.net>
• Date: Thu, 18 Jun 2009 04:51:28 -0400 (EDT)
• References: <h12gg4\$ect\$1@smc.vnet.net> <200906150119.VAA11428@smc.vnet.net> <32685607.1245205072351.JavaMail.root@n11>

```I don't know if I would so much call this a bug as a limitation. The
contours at 1 are discontinuous and we might expect a little trouble there.
Also this is a maximum value of the function and we might expect that to
cause difficulties.

In any case, by changing PlotPoints I was able to obtain the contours at 1.

ContourPlot[Cos[x*y], {x, -Pi, Pi}, {y, -Pi, Pi},
PlotPoints -> 13]

But notice that this misses the other contour values at +1 and -1. Why does
it get one extreme value and not another?

In the following plot we ask for specific values of the contours and pick
values just short of the extremes. If we push MaxRecursion high enough we
get them all.

ContourPlot[Cos[x*y], {x, -Pi, Pi}, {y, -Pi, Pi},
Contours -> (Join[Range[-.8, .8, .2], {.999, -.999}] // Chop),
PlotPoints -> 11,
MaxRecursion -> 4]

You can see that there is a qualitative difference between the 1 contours in
the center and the ones at the edges that Mathematica may have been able to
use.

Using Presentations, we can draw the extreme value contours by drawing the
contours for the underlying x y contours.

Needs["Presentations`Master`"]

Draw2D[
{ContourDraw[Cos[x y], {x, -\[Pi], \[Pi]}, {y, -\[Pi], \[Pi]},
Contours -> Join[Range[-.8, -.2, .2], Range[.2, .8, .2]]],
Gray,
ContourDraw[x y == #, {x, -\[Pi], \[Pi]}, {y, -\[Pi], \[Pi]}] & /@
Range[-2 \[Pi], 2 \[Pi], \[Pi]]},
Frame -> True,
PlotLabel -> Style[Row[{"Contours of ", Cos[x y]}], 16],
ImageSize -> 350]

David Park
djmpark at comcast.net
http://home.comcast.net/~djmpark/

I confirm the issue with version 7.0 for Microsoft Windows (32-bit)
(February 18, 2009).
The problem is always there, even after reducing the plotted area,
like in ContourPlot[Cos[x*y], {x, -Pi/100, Pi/100}, {y, -Pi/100, Pi/
100}], or with different x and y ranges.

On Jun 15, 11:38 am, Syd Geraghty <sydgerag... at me.com> wrote:
> Hi,
>
> After trying for a while to get the contour line 1  to be shown for
> 0<x<~0.5 and 0<y<-0.5 with
>
> ContourPlot[Cos[x*y], {x, -Pi, Pi}, {y, -Pi, Pi}]
>
> It appears ContourPlot has a bug.
...
>
> Syd Geraghty B.Sc, M.Sc.
>
> sydgerag... at mac.com

```

• Prev by Date: Re: Integrate[ x^2 * Erfc[a x] *(BesselJ[1, b x])^2 ,
• Next by Date: Re: Restrictions for J/Link-ed Programs?
• Previous by thread: Re: Re: Extracting contour values from ContourPlot
• Next by thread: Re: Extracting contour values from ContourPlot