Extracting *firstly roots* from some lists to plot their pairs values

I have two different lists as list1 and list2. Their ListPlot3D of them are: and As shown in these plots, there are some points of which {x,y} pairs are first pairs that z get zero by them. For example Red ones for list1 and Green ones for list2. The desired and so important plot which must be extracted from two previous plots is as schematic: As it is clear the desired is the taking two firstly roots of other shapes in one plot as pairs of {x,y}.

If I understand your question correctly, here is a possible approach to extracting the {x, y} list of values corresponding to the zeroes of your function when the function is only available through data points.

First of all, I will generate a data list, since you did not provide one. Let's consider for instance the following function as an example:

f[x_, y_] := 20 x^2 - 3 (y - 2/3)^3 + 750
Plot3D[f[x, y], {x, y} \[Element] Rectangle[{0, 0}, {10, 10}],
Mesh -> {{0.}}, MeshFunctions -> (f[#1, #2] &),
MeshStyle -> {Red, Thick},
AxesLabel -> {x, y, z}
] Here is am using mesh functions to highlight the position of a zero contour for your function. However, you don't have the functional expression, but just a list:

list1 = Table[{x, y, f[x, y]}, {x, 0, 10, 0.5}, {y, 5, 10, 0.2}] // Flatten[#, 1] &;


ListContourPlot can calculate the contour line you want, i.e. the list of points $(x, y)$ for which your function is zero:

list1plot = ListContourPlot[list1, Contours -> {0.}] We can then extract the coordinates of the calculated line:

zeroes = Cases[
Normal@list1plot,
Line[a__] :> a,
Infinity
];


We use Normal here to transform the GraphicsComplex expression generated by ListContourPlot behind the scenes into a simpler Graphics expression, which is easier to handle to extract information from.

Finally, we can plot the zeroes list:

ListPlot[zeroes, AxesLabel -> (Style[#, 18, Red] & /@ {x, y})] UPDATE

I apologize, I missed the links to your data the first time around. Loading those lists as list1 and list2, and using ListLinePlot, rather than ListPlot, then one obtains:

First[Cases[
Normal@ListContourPlot[#, Contours -> {0.}],
Line[a__] :> a, Infinity
]] & /@ {list1, list2};

ListLinePlot[
%,
PlotRange -> All, PlotLegends -> {"list1", "list2"},
AxesLabel -> (Style[#, 18, Red] & /@ {x, y})
] • Besides thanks for your answer I am not understand why you said "since you did not provide one" because in list1 I provided in the address: "speedyshare.com/kyVar/list1.txt" and "speedyshare.com/mDH2n/list2.txt" – Unbelievable May 26 '16 at 19:27
• Or use your mesh?f[x_,y_]:=20 x^2-3 (y-2/3)^3+750 plot=Plot3D[f[x,y],{x,y}\[Element]Rectangle[{0,0},{10,10}],Mesh->{{0.}},MeshFunctions->(f[#1,#2]&),MeshStyle->{Red,Thick},AxesLabel->{x,y,z}]; zeroPoint=Cases[Normal[plot],_Line,Infinity][[-1,-1]]; Plot3D[f[x,y],{x,y}\[Element]Rectangle[{0,0},{10,10}]]~Show~ListPointPlot3D[PadRight[#,3]&/@zeroPoint,PlotStyle->Thick] – yode May 26 '16 at 19:55
• @yode Yes, that would work IF you had a functional expression to use in Plot3D, but OP only has lists, not a function... – MarcoB May 26 '16 at 20:20
• @Irreversible You are right, I missed the links when I read your post. I updated my answer using your data. Sorry for the confusion! – MarcoB May 26 '16 at 20:31
Show[ListContourPlot[#, Contours -> {0}, ContourShading -> None,
ContourStyle -> Directive[Thick, #2]] & @@@
{{list1, Red}, {list2, Green}}] You can first find all the roots by their z value, and then select out the first point that touches zero. For example:

ε0 = 1.*^-3;
ListPlot[Table[
First /@ SplitBy[
Sort[Select[ls, Abs[#[]] < ε0 &][[All, 1 ;; 2]]],
First], {ls, {list1, list2}}], PlotRange -> All] 