Re: Contourline values
- To: mathgroup at smc.vnet.net
- Subject: [mg19998] Re: Contourline values
- From: "Allan Hayes" <hay at haystack.demon.co.uk>
- Date: Sat, 25 Sep 1999 02:40:34 -0400
- References: <7se5tl$qrp@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Rita Bijlsma <R.Bijlsma at iri.tudelft.nl> wrote in message news:7se5tl$qrp at smc.vnet.net... > Hi! > > I can not find a way to get contourline values in contour plots. > > Can it be done (automatically) ? > > Thanks! > Rita > > -- > .-. || Drs. Rita Bijlsma tel: +31-15-2787109 > / \|| IRI dept of Radiation Physics fax: +31-15-2786422 > | ||| Delft University of Technology email: rita at iri.tudelft.nl > | |||_The Netherlands ______________ http://www.iri.tudelft.nl/~rita > Rita, cg = ContourPlot[1/((x - 1)(x + 1)), {x, -2, 2}, {y, 0, 1}, ContourShading -> False, Contours -> 3]; ContourGraphics[] Contour graphics stores a matriex of heights - no explicit lines. To get the lines we convert the contour graphics object to a Graphics object and then use Cases to gert a list of the result of passing the first point coordinates for each line to the expression being plotted. Since there may be, as here, more than one line at the same height, we then use Union to remove duplicates. Cases[Graphics[cg], Line[{{x_, y_}, ___}] :> (1/((x - 1)(x + 1))), Infinity] // Union Out[28]= {-10175.9, -10175.9, -7.48556, -7.48556, -1.63844, -1.63844, 1.1247, 1.1247, \ 6.99341, 6.99341} -- Allan --------------------- Allan Hayes Mathematica Training and Consulting Leicester UK www.haystack.demon.co.uk hay at haystack.demon.co.uk Voice: +44 (0)116 271 4198 Fax: +44 (0)870 164 0565