MathGroup Archive 1999

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

Search the Archive

Re: How display negative contours with dashed lines?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg16868] Re: How display negative contours with dashed lines?
  • From: "Allan Hayes" <hay at haystack.demon.co.uk>
  • Date: Mon, 5 Apr 1999 02:24:15 -0400
  • References: <7e1d1b$bd6@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

WOOD DAVID M <dmwood at slate.Mines.EDU> wrote in message
news:7e1d1b$bd6 at smc.vnet.net...
> Howdy all.
>
>   Despite rooting around like a cyber-pig after Mathematica truffles
> (with DejaNews, AltaVista, and on MathSource), I can find no
> suggestions or even mention of something that I suspect isn't hard to
> do [except for me :)]
>
> I'd like to produce contour plots for which NEGATIVE function values
> are indicated as dashed lines, while other values use solid lines.
>
> Can anyone suggest how I can on-the-fly specify ContourStyle options
> that will display negative contour values (say in ContourPlot or
> ListContourPlot) as *dashed* lines, via (e.g.) Dashing [or in any
> other way]?
>
> Many thanks!
> --
> David M. Wood
> Department of Physics, Colorado School of Mines, Golden, CO 80401
> Phone: (303) 273-3853; Fax: (303) 273-3840
> e-mail: dmwood at physics.Mines.EDU ; NeXTMail welcome
>

David:

It will be simpler if we use a function:

fn[x_,y_]:=x;
cg=ContourPlot[fn[x,y], {x,-1,1},{y,-1,1}, Contours -> 2]

This outputs a ContourGraphics object, which does not store lines
and polygons (please check InputForm[cg])

Convert to a Graphics object, which does (please check InputForm)

gr=Graphics[cg]

Now adjust the contour lines and show

Show[gr/.{dir___,ln_Line/;fn@@ln[[1,1]]<0}:>
{dir,Hue[0], Thickness[.02],Dashing[{.05,.05}], ln}]

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: New position: MathLink Developer
  • Next by Date: Re: Q: LinkInterrupt[link]
  • Previous by thread: How display negative contours with dashed lines?
  • Next by thread: Re: How display negative contours with dashed lines?