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


Groups > comp.soft-sys.math.mathematica > #15153

Re: color surface according to absolut value of the gradient

From Bob Hanlon <hanlonr357@gmail.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: color surface according to absolut value of the gradient
Date 2013-07-09 06:44 +0000
Message-ID <krgbh0$nvb$1@smc.vnet.net> (permalink)
References <20130708082302.A7B1B69DC@smc.vnet.net>
Organization Time-Warner Telecom

Show all headers | View raw


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@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?
>
> Thanks in advance,
> Conrad
>
>

Back to comp.soft-sys.math.mathematica | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

Re: color surface according to absolut value of the gradient Bob Hanlon <hanlonr357@gmail.com> - 2013-07-09 06:44 +0000
  Re: color surface according to absolut value of the gradient conrad.clausz@gmail.com - 2013-07-10 07:23 +0000

csiph-web