Re: extracting contour points
- To: mathgroup at smc.vnet.net
- Subject: [mg92482] Re: extracting contour points
- From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
- Date: Wed, 1 Oct 2008 18:32:24 -0400 (EDT)
- Organization: The Open University, Milton Keynes, UK
- References: <gbulri$ld4$1@smc.vnet.net>
peterp wrote: > I've searched the group but I still have a problem. The contour sought > below returns two lines (you can actually see them on the graphic output). > The commands after the contour plot only extract the coordinates of one > of the two lines. How do I get the second ? The code you have posted does not work at all, because: . There are syntax errors . Erroneous level specification . When all the above have been corrected, Mathematica still counts only one Line > I tried replacing "First" by "Second" but no dice. :-) Use *Part* (shortcut [[ ]] > Thanks, > Peter > > f[p_, a_, x_] = - p x + x^(a + 1) > > contour = > ContourPlot[Arg[f[1, .6, x + I y]], {x, -2, 2}, {y, -2, 2}, Contours > -> {0}, > ContourShading -> False, PlotPoints -> 100] > > grcontour = Graphics[contour]; > InputForm[grcontour]; > lns = First[ > Cases[First[grcontour] // Normal, Line[pts_] -> pts, \ > [Infinity]]]; ==^^^^^^^^^^ Syntax error: curly braces are required here: {Infinity} Second error: to find the head Line, you must start from level zero, i.e. {0, Infinity} > dat = Table[lns]; =============^^^^^^ Syntax error: Table requires two operands, the second being an iterator. > Export["junk.dat", Re[dat]] > In[1]:= f[p_, a_, x_] := (-p)*x + x^(a + 1) contour = ContourPlot[Arg[f[1, 0.6, x + I*y]], {x, -2, 2}, {y, -2, 2}, Contours -> {0}, ContourShading -> False] grcontour = Graphics[contour]; lns = Cases[Normal[First[grcontour]], Line[pts_] -> pts, {0, Infinity}][[1]]; Count[Normal[grcontour], _Line, {0, Infinity}] Out[5]= 1 In[6]:= contour = ContourPlot[Arg[f[1, 0.6, x + I*y]], {x, -2, 2}, {y, -2, 2}, Contours -> {0, 1}, ContourShading -> False] grcontour = Graphics[contour]; lns = Cases[Normal[First[grcontour]], Line[pts_] -> pts, {0, Infinity}][[1, 2]]; Length[lns] Count[Normal[grcontour], _Line, {0, Infinity}] Out[9]= 2 Out[10]= 3 HTH, -- Jean-Marc