Re: Define a function as a graphics directive?

• To: mathgroup at smc.vnet.net
• Subject: [mg105054] Re: [mg105020] Define a function as a graphics directive?
• From: Bob Hanlon <hanlonr at cox.net>
• Date: Thu, 19 Nov 2009 05:23:53 -0500 (EST)

```Show[
ContourPlot[z Exp[-Sqrt[z^2 + x^2]/2],
{x, -10, 10}, {z, -10, 0},
Contours -> 7,
ContourStyle -> {{Red, Thick}}],
ContourPlot[z Exp[-Sqrt[z^2 + x^2]/2],
{x, -10, 10}, {z, 0, 10},
Contours -> 7,
ContourStyle -> {{Black, Thick}}],
PlotRange -> {{-10, 10}, {-10, 10}}]

Bob Hanlon

---- Porscha Louise McRobbie <pmcrobbi at umich.edu> wrote:

=============
Hi,

I have a very simple contour plot:

ContourPlot[ z Exp[-Sqrt[z^2 + x^2]/2.], {x, -10, 10}, {z, -10, 10},
ContourShading -> None, Contours -> 15,
ContourStyle -> {{Black, Thick}}]

I do not want the plot shaded, but I want to color the contour lines
according to  a function of z (e.g., Sign[z], where z>0 is black, z<0
is red). Can this be done within ContourStyle?

I tried putting a function definition for the color inside
ContourShading, but I get an error since it's not a graphics directive
(and it's my understanding that ColorFunction is only for shading the
regions between contours).

Thanks for any input!
Porscha

```

• Prev by Date: Re: Undo in Mathematica
• Next by Date: Re: Define a function as a graphics directive?
• Previous by thread: Define a function as a graphics directive?
• Next by thread: Re: Define a function as a graphics directive?