MathGroup Archive 1999

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

Search the Archive

Re: contourplots


>Hello Mathgroup,
>
>Is it possible to do ContourPlots with no Shading but with a different color
>for each contour line?
>
>Laurence Lours
>
>

Laurence,

Here is the code for a simple example:

f[x_, y_] := x^2 + y^2

plot1 = ContourPlot[f[x, y], {x, -5, 5}, {y, -5, 5}, 
    ContourShading -> False];

colfun[z_] := Hue[z/50]

clines = First[Graphics[plot1]] /. Line[pts_] :> 
     {colfun[f @@ pts[[1]]], Line[pts]}; 

Show[Graphics[{clines}], AspectRatio -> Automatic, Frame -> True, 
  FrameLabel -> {x, y}, PlotLabel -> f[x, y]]

I am separately sending you a notebook which illustrates it in more detail.

David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/




  • Prev by Date: Re: Manipulating a list of pairs
  • Next by Date: Re: space disappears when printing
  • Previous by thread: contourplots
  • Next by thread: Re: contourplots