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: [mg16893] Re: How display negative contours with dashed lines?
  • From: Jens-Peer Kuska <v-jkuska>
  • Date: Mon, 5 Apr 1999 02:24:27 -0400
  • Organization: Wolfram Research, Inc.
  • References: <7e1d1b$bd6@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Hi David,

it is not so easy as it seems. Here is a quick and dirty solution

MarkNegativeContours[c_ContourGraphics] := 
  Module[{z0, z1, cntNo, dz, cpos, csty, cc},
      {z0, z1} = Last[PlotRange /. FullOptions[c]];
    cntNo = Contours /. FullOptions[c] /. {l_} :> l;
    If[Head[cntNo] === List, Return[c]];
    If[! NumericQ[cntNo], cntNo = 10.];
    dz = (z1 - z0)/(cntNo + 1);
    cpos = Table[z0 + i*dz, {i, 1, Round[cntNo]}];
    csty = {If[# < 0., Dashing[{0.02, 0.01}], Dashing[]]} & /@ cpos;
    cc = c /. (Contours -> _) :> (Contours -> cpos) /. 
        (ContourStyle -> _) :> (ContourStyle -> csty);
    If[FreeQ[Last[cc], Contours], 
      cc\[LeftDoubleBracket]2\[RightDoubleBracket] = 
        Append[cc\[LeftDoubleBracket]2\[RightDoubleBracket], 
          Contours -> cpos]];
    If[FreeQ[Last[cc], ContourStyle], 
      cc\[LeftDoubleBracket]2\[RightDoubleBracket] = 
        Append[cc\[LeftDoubleBracket]2\[RightDoubleBracket], 
          ContourStyle -> csty]
      ];
    cc
    ]

Hope that helps
  Jens


WOOD DAVID M wrote:
> 
> 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


  • Prev by Date: Re: semi-transparent surfaces
  • Next by Date: Re: Plotting multiple outputs from cpu intensive functi
  • Previous by thread: Re: How display negative contours with dashed lines?
  • Next by thread: Re: How display negative contours with dashed lines?