Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #10185 > unrolled thread

Question about ColorFunction

Started byJee Lou <ywdr1987@gmail.com>
First post2012-05-23 07:30 +0000
Last post2012-05-24 07:31 +0000
Articles 2 — 2 participants

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  Question about ColorFunction Jee Lou <ywdr1987@gmail.com> - 2012-05-23 07:30 +0000
    Re: Question about ColorFunction Chris Degnen <degnen@cwgsy.net> - 2012-05-24 07:31 +0000

#10185 — Question about ColorFunction

FromJee Lou <ywdr1987@gmail.com>
Date2012-05-23 07:30 +0000
SubjectQuestion about ColorFunction
Message-ID<jpi3me$4sm$1@smc.vnet.net>
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?

[toc] | [next] | [standalone]


#10196

FromChris Degnen <degnen@cwgsy.net>
Date2012-05-24 07:31 +0000
Message-ID<jpko3o$ek8$1@smc.vnet.net>
In reply to#10185
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).

So in your example:

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.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web