color surface according to absolut value of the gradient
- To: mathgroup at smc.vnet.net
- Subject: [mg131452] color surface according to absolut value of the gradient
- From: conrad.clausz at gmail.com
- Date: Mon, 8 Jul 2013 04:23:02 -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
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? Thanks in advance, Conrad
- Follow-Ups:
- Re: color surface according to absolut value of the gradient
- From: Bob Hanlon <hanlonr357@gmail.com>
- Re: color surface according to absolut value of the gradient