Re: ColorFunction and question about how to use it
- To: mathgroup at smc.vnet.net
- Subject: [mg101664] Re: ColorFunction and question about how to use it
- From: Bill Rowe <readnews at sbcglobal.net>
- Date: Tue, 14 Jul 2009 05:32:32 -0400 (EDT)
On 7/12/09 at 5:49 AM, david.b.a.epstein at googlemail.com (David) wrote: >Here is some Mathematica code >In[2]:= Plot3D[x + y, {x, -2, 2}, {y, -2, 1}, >ColorFunction -> Function[{x, y, z} -> Hue[z]]] >Plot3D[x + y, {x, -2, 2}, {y, -2, 1}] >-------------------------------------------------------------------- >The first Plot3D command gives me only black and white. >Why is that? Otherwise it looks fine. Incorrect syntax. Presumably you want: Plot3D[x + y, {x, -2, 2}, {y, -2, 1}, ColorFunction -> Function[{x, y, z}, Hue[z]]] >The second Plot3D command >gives me the graph in a uniform blue. Why is that? Apart from the >colour, the two graphs look the same. I've no real explanation other than the observation, your function has a constant gradient and varies little over the range you specified. I assume this is why there is essentially no variation in the color.