Re: Question about Mathematica
- To: mathgroup@smc.vnet.net
- Subject: [mg11167] Re: [mg11106] Question about Mathematica
- From: seanross@worldnet.att.net
- Date: Wed, 25 Feb 1998 03:31:41 -0500
- References: <199802221955.OAA14802@smc.vnet.net.>
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.
- References:
- Question about Mathematica
- From: Nuno Catarino <Nuno.Catarino@lps.ens.fr>
- Question about Mathematica