question about ColorFunction
- To: mathgroup at yoda.physics.unc.edu
- Subject: question about ColorFunction
- From: Ed_Donley <HEDONLEY at grove.iup.edu>
- Date: Sun, 24 Jan 1993 00:36 EST
I have a two dimensional table all of whose elements are 0, 1, 2, or 3. I am
trying to create a ListDensityPlot with a different color assigned to each of
these four values. The following does not display four colors as I had
expected. Does anyone know where I went wrong?
In[1]:= colormap[f_] := Switch[Floor[f],
0,RGBColor[.25,1,.25],
1,RGBColor[1,0,1],
2,RGBColor[0,1,1],
3,RGBColor[0,0,1]]
In[2]:= table = Table[Mod[x+y,4],{x,0,10},{y,0,10}];
In[3]:= ListDensityPlot[table, Mesh -> False,
ColorFunction -> (colormap[#]&)];
Thank you,
H. Edward Donley
Mathematics Department
Indiana University of PA
Indiana, PA 15705 USA
Phone: 412-357-3792
Internet: hedonley at grove.iup.edu