Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1993

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

Search the Archive

question about ColorFunction

  • To: mathgroup at
  • Subject: question about ColorFunction
  • From: Ed_Donley <HEDONLEY at>
  • 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],

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

  • Prev by Date: multiple parametric plots
  • Next by Date: thanks and more help...
  • Previous by thread: multiple parametric plots
  • Next by thread: Re: question about ColorFunction