MathGroup Archive 1998

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

Search the Archive

Re: Question about Mathematica



Nuno Catarino wrote:
> 
> I've recently started to use Mathematica to get some images through the
> command 'ListDensityPlot' and I couldn't find anywhere in the manual
> how to get those images in colours. It doesn't seem to be possible to
> use 'RGBColor' and I can't define properly the spectrum through the
> command 'Hue'. If you could help me on this subject, I would be
> delighted.
> 
>      Nuno Catarino


Hue[0] is red and goes through the colors in spectral order up to
Hue[.9999].  You can map the range from 1 to 0 to the wavelength range
from 400 to 700nm.  RGBColor works just fine.  I suspect the problem is
in the exact way you are trying to implement them.  It usually requires
a pure function construct wrapped in parenthesis to get them to work. 
For example:

ListDensityPlot[N[Table[Sin[x+y],{x,-Pi,Pi,Pi/10},{y,-Pi,Pi,Pi/10}]],
  ColorFunction->(Hue[#^2,.5,Sqrt[#]]&)]

or

ListDensityPlot[N[Table[Sin[x+y],{x,-Pi,Pi,Pi/10},{y,-Pi,Pi,Pi/10}]],
  ColorFunction->(RGBColor[ #,.5,#^2]&)]


The construct f[#]&  is called a pure function.  The # parameter stands
in place of the argument.  The ColorFunction is understood to accept an
argument from 0 to 1 which is mapped to the low and high ranges of the
graph, so Hue[#]& gives a red color to the low spots and a purple color
to the high spots.
-- 
Remove the _nospam_ in the return address to respond.



  • Prev by Date: Re: Mathematica Graphics for V3?
  • Next by Date: Re: New version of PowerSeries.m
  • Prev by thread: Question about Mathematica
  • Next by thread: RE: Question about Mathematica