MathGroup Archive 2007

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

Search the Archive

Re: Contour Lines


f[x_, y_] := x^2 + 2 y^2
plot1 = ContourPlot[f[x, y], {x, -2, 2}, {y, -2, 2}, Contours -> {1},
   ContourShading -> False, PlotPoints -> {30, 30}]
lines = Cases[Normal@plot1, _Line, Infinity];
Graphics@lines

Bobby

On Fri, 23 Nov 2007 04:38:41 -0600, Wyn Evans <nwe at ast.cam.ac.uk> wrote:

>
> How do you extract the coordinates of points making up a Contour Line as
> a List?
>
> This has been dealt with before in the archive (see e.g., [mg68657])
> but the code there seems no longer to work. For example, the following is
> suggested
>
> f[x_, y_] := x^2 + 2y^2
> plot1 = ContourPlot[f[x, y], {x, -2, 2}, {y, -2, 2}, Contours -> {1},
>       ContourShading -> False, PlotPoints -> {30, 30}];
> f[x_, y_] := x^2 + 2y^2
> plot1 = ContourPlot[f[x, y], {x, -2, 2}, {y, -2, 2}, Contours -> {1},
>       ContourShading -> False, PlotPoints -> {30, 30}];
>
> Convert the ContourGraphics to Graphics and then extract the first part
> and you will see how Mathematica represents the contours.
>
> contour = First@Graphics@plot1
> (output omitted)
>
>
> I can see that the data I want (the actual coordinates) is there, but I
> can't figure how to extract it as a matrix or list.
>
>
>
>



-- 

DrMajorBob at bigfoot.com


  • Prev by Date: Re: VectorFieldPlot Arrows
  • Next by Date: Re: Button[label, action] Change Font?
  • Previous by thread: Re: Contour Lines
  • Next by thread: Re: Contour Lines