       Re: Contour levels

• To: mathgroup at smc.vnet.net
• Subject: [mg83817] Re: [mg83766] Contour levels
• From: Bob Hanlon <hanlonr at cox.net>
• Date: Sat, 1 Dec 2007 05:46:04 -0500 (EST)
• Reply-to: hanlonr at cox.net

```cplot = ContourPlot[x^2 + y^2,
{x, -1, 1}, {y, -1, 1}]

data = Cases[First[cplot] // Normal,
Line[pts_] -> pts, Infinity];

ListPlot[data, Joined -> True,
Frame -> True, Axes -> False,
AspectRatio -> Automatic]

data2 = Select[data,
Abs[Total[#[]^2] - 0.4] < 0.01 &];

ListPlot[data2, Joined -> True,
Frame -> True, Axes -> False,
AspectRatio -> Automatic]

Bob Hanlon

---- sigmundv at gmail.com wrote:
> A few days ago a question was posted on how to extract the coordinates
> defining each of the contours returned by ContourPlot[]. Then I would
> like to ask if there is any way to also get the level they belong to?
> Let me illustrate the question by an example:
>
> If I plot the contours (or level curves) of the scalar function f(x,y)
> = x^2 + y^2 by using
>
> cplot = ContourPlot[x^2+y^2,{x,-1,1},{y,-1,1}]
>
> in Mathematica 6.0, I get a few circles. The points defining these
> circles are extracted as follows:
>
> Cases[First[cplot] // Normal, Line[pts_] -> pts, Infinity];
>
> This returns a few lists, each containing a selection of points on a
> circle. Then my question is, if there is any way I can get the level
> to which each of these lists belong. That is, can I ask Mathematica
> which list of points belongs to f(x,y) = 0.4, for example, or, which
> level does a given list of points belong to?
>
> Kind regards,
> Sigmund Vestergaard
>

```

• Prev by Date: Re: Mathematica: Long divison for polynomials
• Next by Date: Re: Manipulate with very computationally large problems
• Previous by thread: Re: Contour levels
• Next by thread: Re: Manipulate with very computationally large problems