Re: Contour Lines
- To: mathgroup at smc.vnet.net
- Subject: [mg83592] Re: [mg83583] Contour Lines
- From: DrMajorBob <drmajorbob at bigfoot.com>
- Date: Sat, 24 Nov 2007 04:08:11 -0500 (EST)
- References: <20637792.1195837227004.JavaMail.root@m35>
- Reply-to: drmajorbob at bigfoot.com
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