Re: Question about Mathematica
- To: mathgroup@smc.vnet.net
- Subject: [mg11140] Re: Question about Mathematica
- From: Allan Hayes <hay@haystack.demon.co.uk>
- Date: Mon, 23 Feb 1998 21:40:59 -0500
- References: <6cna8t$bgv@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, You need to use the options. The list of options is given bu Options[ListDensityPlot] But it's probably better to look up ListDensityPlot in the Help Browser. This will direct you to DensityGraphics, which give all the options. Then use the Help Browser to find out about the options. Here is an example. In[1]:= data=Table[x,{x,.05,1.95,.1},{y,.25,.75,.5}]; In[2]:= ListDensityPlot[data, ColorFunction -> (Hue[2/3 #]&), MeshRange-> {{0,1},{0,2}}, FrameLabel ->{"y","x"} ] In[3]:= ListDensityPlot[data, ColorFunction -> (Hue[2/3 #]&), PlotRange -> {.5,1.5}, FrameLabel ->{"y","x"} ] Notes: Hue[0] = red then through the spectrum to and back to red for Hue[1], so to stop at Blue, I scale the inputs by 2/3. The function Hue[2/3 #]& receives the data entries after they have been 1. truncated to PlotRange 2 then scaled to [0,1] from lowest to highest of the truncated values. MeshRange-> {{0,1},{0,2}} give the horixontal and vertical ranges for the ticks in the display (default is {{0, Number of columns},{0, Number of rows}}). The data is displayed with rows running bottom to top and columns left to right. -- Allan Hayes Mathematica Training and Consulting Leicester, UK hay@haystack.demon.co.uk http://www.haystack.demon.co.uk voice: +44 (0)116 271 4198 fax: +44 (0)116 271 8642