       • To: mathgroup at smc.vnet.net
• Subject: [mg126604] Re: Question about ColorFunction
• From: Chris Degnen <degnen at cwgsy.net>
• Date: Thu, 24 May 2012 03:30:38 -0400 (EDT)
• Delivered-to: l-mathgroup@mail-archive0.wolfram.com
• References: <jpi3me\$4sm\$1@smc.vnet.net>

```On Wednesday, May 23, 2012 8:30:22 AM UTC+1, Jee Lou wrote:
> Anyone explain to me how ColorFunction works? Why Plot3D[Sin[x + y], {x,
0, 3}, {y, 0, 3},  ColorFunction -> (Hue[Sin[#1 + #2]] &)] and Plot3D[Sin[x
+ y], {x, 0, 3}, {y, 0, 3}, ColorFunction -> (Hue[#3] &)] return different
color distributions?

The explanation is alluded to in the 'MORE INFORMATION' section of the Help
on ColorFunction, at:

http://reference.wolfram.com/mathematica/ref/ColorFunction.html

I.e.

ColorFunction->"name" is equivalent to ColorFunction->(ColorData["name"][#i]&) where the slot used is as follows: Plot, ListPlot, etc.: #2 (y); ArrayPlot, ReliefPlot: #1 (a); ContourPlot, DensityPlot, etc.: #1 (f); ContourPlot3D, etc.: #4 (f); Plot3D, etc.: #3 (z).

Plot3D[Sin[x + y], {x, 0, 3}, {y, 0, 3}, ColorFunction -> (Hue[Sin[#1 + #2]] &)]

#1 and #2 are the x and y values respectively.  You can see the effect if you just use Sin[#1] or Sin[#2].

Using #3 uses the z value.

```

• Prev by Date: Re: Question about ColorFunction
• Next by Date: Re: Fourier DFT scaling problem