MathGroup Archive 1999

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

Search the Archive

RE: contourplots


Laurence Lours  wrote:
--------------------
Is it possible to do ContourPlots with no Shading but with a different color
for each contour line?

-----------------------
As other indicated you can do that with the ContourStyle option.  The
setting of this option should be a list of styles where each style is a list
in itself.  If you have contours at say 10 different levels and you provide
4 styles it will cycle through the different styles as required.  In the
example below I provide enough styles to have a different one for each
contour level. 

In[52]:=
styles=Table[{Hue[h,1,1]},{h, 0.6, 1, 0.03}];
ContourPlot[Sin[x y],{x,-2,2},{y,-2,2},ContourShading->False,
    ContourStyle->styles];

(* Graphic not shown. *)

-----------------------
Notice you can also specify which contours should be used. Using the line
below you get a contour along paths where Sin[x y] is 
-0.75,-0.5,-0.25,0.25,0.5,0.75

In[54]:=
styles=Table[{Hue[h,1,1]},{h,0.6,1,0.06}];
ContourPlot[Sin[x y],{x,-2,2},{y,-2,2},ContourShading->False,
    ContourStyle->styles,Contours->{-0.75,-0.5,-0.25,0.25,0.5,0.75}];

(* Graphic not shown *)

--------------------
Regards,
Ted Ersek

For Mathematica tips, tricks see 
http://www.dot.net.au/~elisha/ersek/Tricks.html



  • Prev by Date: searchforperiod
  • Next by Date: Sound and Mathematica
  • Previous by thread: Re: contourplots
  • Next by thread: InputForm Query