# How to extract a line from a ContourPlot with a condition

I made a ContourPlot of a fuction at the points where its value is zero. So my command is written as follows:

ContourPlot[(TE[n, k0, \[Beta]] //. {\[Beta] -> k0*neff, n -> 0}) == 0, {k0, 2 \[Pi]/3, 2 \[Pi]/0.5}, {neff, n2*(1 + \[Delta]),n1*(1 - \[Delta])}, PlotPoints -> 100]


And so I have a 2D plot of several lines, given the condition I set. The code and plot look like this: I want to extract the first line of this plot to use it in another plot. I don't need its coordinates and I don't want any region between lines, I just want to restrict the quantity of lines in this plot to only one, specifically, the first one, since my interest lies in the first set of values for which my function is zero. I've tried using the "Contour" option but it seems to work only for contour plots with no restrictions. In my case, it worked when I plotted the contours of the function with no conditions, but given the condition that it should equals zero, the Contour option makes no difference at all in this case.

Thanks in advance for any help!

Edit: for clarity's sake here goes the definition of my function and all the parameters involved in it: • what are TE, n1 and n2? – kglr Nov 16 '18 at 20:18
• TE is called the dispersion relation, which is the characteristic function for the eletromagnetic waves in a optical fiber. A eletromagnectic wave is guided in the optical fiber when k0 and beta are so that TE equals zero. The variable "n" of the function indicates the order of the Bessel functions involved. So for each "n" there is a set of k0 and beta for which TE is zero and therefore we have a "physical solution" of the problem. n1 and n2 are the refractive indexes previously defined as n1=1.45 and n2=1. – Louise Trivizol Nov 16 '18 at 22:28
• If you provide the mathematica code(!) @kglr asked for your chance of getting a helpful answer would increase dramatically! – Ulrich Neumann Nov 17 '18 at 13:34
• oh ok, sorry, i'm new here. didn't know how to add the code in the comment section. i'll edit my question. – Louise Trivizol Nov 17 '18 at 15:31

As an example (because OP doesn't provide all info...) here is a picture with three diffeerent lines:

pic = ContourPlot[{(y == 1/x ) , (y - 1/2 == 1/(x - 1/2)), (y - 1 == 1/(x - 1))  }, {x, 0, 4}, {y, 0, 4}] Now let's try to get the first line of the plot

points = pic[[1, 1]]; (* all points*)
lines = Level[Cases[pic, _Line, Infinity], {-2}] (* all lines *)


plot of first line lines[]

Show[pic,Graphics[{Red, Opacity[.2], Thickness[.025],Line[points[[lines[]]]]}]] • it was very helpful! seting the opacity to 1 and the colour of the line to white, i could "remove" all of the lines i don't want in the plot. but i didn't quite understand what's happening on "lines" command, if you could comment on that i would be very grateful. but my problem is solved, anyways. thanks :) – Louise Trivizol Nov 17 '18 at 16:14
• If you look into the picture (??pic) you see a GraphicsComplex. pic[[1,1]] gives you all the plotted points. In the listed GraphicsComplex you find several (in the example 3) commands beginning with Line[...] My code lines=...`just extracts the pointnumbers of these Lines. – Ulrich Neumann Nov 17 '18 at 16:21