Re: color surface according to absolut value of the gradient

• To: undisclosed-recipients:;
• Subject: [mg131456] Re: color surface according to absolut value of the gradient
• From: Bob Hanlon <hanlonr357 at gmail.com>
• Date: Tue, 9 Jul 2013 06:50:29 -0400 (EDT)
• Delivered-to: l-mathgroup@mail-archive0.wolfram.com
• Delivered-to: l-mathgroup@wolfram.com
• Delivered-to: mathgroup-outx@smc.vnet.net
• Delivered-to: mathgroup-newsendx@smc.vnet.net
• References: <20130708082302.A7B1B69DC@smc.vnet.net>

```Use ColorFunctionScaling -> False:

ListPlot3D[data,
ColorFunction -> (ColorData["Rainbow"][
Sqrt[D[f[x, #2], x]^2 + D[f[#1, y], y]^2] /.
{x -> #1, y -> #2}] &),
ColorFunctionScaling -> False]

Bob Hanlon

On Mon, Jul 8, 2013 at 4:23 AM, <conrad.clausz at gmail.com> wrote:

> I have a set of data, let's say
>
> data = Flatten[
>    Table[{i, j,
>      Sin[i] Cos[
>        j]}, {i, -\[Pi], \[Pi], .25}, {j, -\[Pi], \[Pi], .25}], 1];
>
> If I plot this, everything is fine. To get the derivatives I interpolated
> the set of data
>
> f = Interpolation[data];
>
> If I then plot the absolute value of the gradient in the same range it
> also looks correct.
>
> ListPlot3D[
>  Flatten[Table[{i, j,
>     Sqrt[D[f[x, y], x]^2 + D[f[x, y], y]^2] /. {x -> i,
>       y -> j}}, {i, -\[Pi], \[Pi], .25}, {j, -\[Pi], \[Pi], .25}], 1]]
>
> Now I want to plot the original data with the surface colored according to
> the values of the last plot. I tried
>
> ListPlot3D[data,
>  ColorFunction -> (ColorData["Rainbow"][
>      Sqrt[D[f[x, #2], x]^2 + D[f[#1, y], y]^2] /. {x -> #1,
>        y -> #2}] &)]
>
> but the result is definitely off. What am I making wrong?
>