MathGroup Archive 1995

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

Search the Archive

Re: color in ListContourPlot

  • Subject: [mg2250] Re: [mg2230] color in ListContourPlot
  • From: ptk at imada.ou.dk (Peder Thusgaard Ruhoff)
  • Date: Wed, 18 Oct 1995 05:56:03 GMT
  • Approved: usenet@wri.com
  • Distribution: local
  • Newsgroups: wri.mathgroup
  • Organization: Wolfram Research, Inc.
  • Sender: daemon at wri.com ( )

On Tue, 17 Oct 1995, Elizabeth Kraemer <kraemer at service1.uky.edu> wrote:

> 
> I want to do a ListContourPlot with a specific color range (from 
> white/purple to red).  If I just use "Hue", the high and low values are red.  
> I've got a lot of contours, so I want to avoid having to define a color 
> individually for each one.  I'm running Mathematica on a Windows machine.  
> Thanks for the help!  -Beth
> 
> 

Dear Beth,

You can use the option ColorFunction.

First let us generate an array of numbers

    In[1]:= a = Table[
                    Sin[x Sin[y Cos[x]]],
                    {x, -Pi, Pi, Pi/20},
                    {y, -Pi, Pi, Pi/20}
                ];

We can get a contour plot in the following way

    In[2]:= ListContourPlot[a]

    Out[2]= -ContourGraphics-

Now, to change the coloring of the contours we can do the following

    In[3]:= ListContourPlot[a, ColorFunction -> (GrayLevel[0.5 + #/2]&)]

    Out[3]= -ContourGraphics-

which on my B/W monitor makes the plot much "lighter". I guess you can
do the same in your problem with something like
              
                ColorFunction -> (Hue[#/2]&)

Of course, if you don't like the pure function approach you can define
a function, e.g.

    In[4]:= MyOwnColorFunction[val_] := Hue[0.5 + val/2]

    In[5]:= ListContourPlot[a, ColorFunction -> MyOwnColorFunction]

    Out[5]= -ContourGraphics-

Good luck,

Peder
------------------------------------------------------------------------------
Peder Thusgaard Ruhoff                     Phone: (+45) 66 15 86 96, ext. 2411
Dept. of Mathematics and Computer Science  Fax:   (+45) 65 93 26 91
Odense University, Campusvej 55            Email: ptk at imada.ou.dk
DK-5230 Odense M, DENMARK

  "It is important for him who wants to discover not to confine himself
   to one chapter of science, but to keep in touch with various others."
                                                            - Jacques Hadamard
------------------------------------------------------------------------------



  • Prev by Date: Problems loading packages in 2.2.4 for Win
  • Next by Date: Problems loading packages in 2.2.4 for Win
  • Previous by thread: Re: color in ListContourPlot
  • Next by thread: Re: color in ListContourPlot