Contour Lines
- To: mathgroup at smc.vnet.net
- Subject: [mg83583] Contour Lines
- From: Wyn Evans <nwe at ast.cam.ac.uk>
- Date: Fri, 23 Nov 2007 05:38:41 -0500 (EST)
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.