Re: ColorFunctions again (making z=0 be different from z=1)

• To: mathgroup at smc.vnet.net
• Subject: [mg50603] Re: ColorFunctions again (making z=0 be different from z=1)
• From: "Peltio" <peltio at twilight.zone>
• Date: Sun, 12 Sep 2004 04:42:14 -0400 (EDT)
• References: <chk0cu\$sj\$1@smc.vnet.net> <chpa0a\$jsl\$1@smc.vnet.net> <chroci\$50m\$1@smc.vnet.net> <chum80\$jop\$1@smc.vnet.net>
• Reply-to: "Peltio" <peltioNOSP at Mdespammed.com.invalid>
• Sender: owner-wri-mathgroup at wolfram.com

```"Peltio" wrote

>We can define a function
>
>     WhiteToColor[h_][x_, maxBk_:0, maxWh_:1] :=
>        Hue[h, maxBk + x(maxWh - maxBk), 1]

I forgot: changing the third parameter in Hue so that it will vary with x

WhiteToColor[h_][x_, maxBk_:0, maxWh_:1] :=
Hue[h, maxBk + x(maxWh - maxBk), 1-.5 x]

....will give a better contrast. See this for example:

DensityPlot[Sin[(x + y)*y], {x, -Pi,Pi}, {y, -Pi, Pi},
PlotPoints -> 50, Mesh -> False, ColorFunction ->WhiteToColor[1]];

and this

Plot3D[Sin[x^2+y^2]/(x^2+y^2) ,{x, -4, 4}, {y, -4, 4},
ColorFunction ->WhiteToColor[.84],
PlotRange -> All, PlotPoints -> 150, Mesh->False];

(using just x, instead of 1-.5 x) gives a transition from black to the
chosen color - not a great sight)

cheers,
Peltio