MathGroup Archive 2009

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

Search the Archive

Define a function as a graphics directive?

  • To: mathgroup at
  • Subject: [mg105020] Define a function as a graphics directive?
  • From: Porscha Louise McRobbie <pmcrobbi at>
  • Date: Wed, 18 Nov 2009 06:58:03 -0500 (EST)


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!

  • Prev by Date: Re: Undo in Mathematica
  • Next by Date: Re: Sound Functions Crash Kernel
  • Previous by thread: Re: Preserve notebook's $ContextPath between sessions /
  • Next by thread: Re: Define a function as a graphics directive?