Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1999
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1999

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Contourline values

  • To: mathgroup at smc.vnet.net
  • Subject: [mg20062] Re: Contourline values
  • From: "Allan Hayes" <hay at haystack.demon.co.uk>
  • Date: Wed, 29 Sep 1999 03:33:23 -0400
  • References: <7se5tl$qrp@smc.vnet.net> <7sho0u$1jq@smc.vnet.net> <7sjl4l$ef6$1@dragonfly.wolfram.com>
  • Sender: owner-wri-mathgroup at wolfram.com

Kevin,

When we enter

cgo=ContourPlot[1/((x - 1)(x + 1)), {x, -2, 2}, {y, 0, 1},ContourShading ->
False, Contours -> 3];

Mathematica generates the ContourGraphics object ( containing a matrix of  heights);
uses this to generate the displayed picture (a side efffect); returns
ContourGraphics object as its value and assigns it to cgo.

Mathematica knows what to do with a ContourGraphics object, and if we enter

    Show[cgo]

then it again generates the display, and outputs cgo

When

Graphics[cgo]

is evaluated it generates a Graphics object containing the the explicit Line
objects that make the contour lines ( and if we allow contour shading it
includes the polygons that provide this)

The way that this is done is indicated briefly in
    Mathematica Graphics by Tom Wickham-Jones

For a contour lines, interpolation is used to find crossings of the
rectangles defined by the grid.
When the lines have been constructed the polygons are made.

But I have not seen the details.


--
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









Kevin J. McCann <kevinmccann at Home.com> wrote in message
news:7sjl4l$ef6$1 at dragonfly.wolfram.com...
> Allan,
>
> I had a look at your example and wonder if you could elaborate a bit on
what
> happened.  If I look at cg with FullForm, I get  stuff like:
>
> cg = ContourPlot[1/((x - 1)(x + 1)), {x, -2, 2}, {y, 0,
1},ContourShading ->
> False, Contours -> 3];
>
> cg//FullForm
>
> Produces:
> ContourGraphics[List[List[0.333333, 0.515789, ...
>
>
> On the other hand
>
> Graphics[cg]//FullForm
>
> Produces:
>
> Graphics[List[
>     List[GrayLevel[0.], AbsoluteThickness[0.5],
>       Line[List[List[1.37445, 1.], List[1.37445, 0.928571],...
>
> I don't see the correlation.  In particular, I don't see how the first
{x,y}
> point in the Line, viz. {1.37445,1.}, is produced from the earlier
> ContourGraphics.
>
> Thanks,
>
> Kevin
>
>
> Allan Hayes <hay at haystack.demon.co.uk> wrote in message
> news:7sho0u$1jq at smc.vnet.net...
> >
> > 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
> >
> >
> >
>
>
>
>



  • Prev by Date: Re: Fourier Spectrum of Sound
  • Next by Date: Re: Enumerating Permutations
  • Previous by thread: Re: Contourline values
  • Next by thread: fractions as axes-labels?