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


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

Re: color surface according to absolut value of the gradient

Started byBob Hanlon <hanlonr357@gmail.com>
First post2013-07-09 06:44 +0000
Last post2013-07-10 07:23 +0000
Articles 2 — 2 participants

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

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  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

#15153 — Re: color surface according to absolut value of the gradient

FromBob Hanlon <hanlonr357@gmail.com>
Date2013-07-09 06:44 +0000
SubjectRe: color surface according to absolut value of the gradient
Message-ID<krgbh0$nvb$1@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@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
>
>

[toc] | [next] | [standalone]


#15159

Fromconrad.clausz@gmail.com
Date2013-07-10 07:23 +0000
Message-ID<krj25i$1jq$1@smc.vnet.net>
In reply to#15153
Thanks Bob, this did the trick. In my original data I had to rescale the range but then it worked perfectly.

Conrad

Am Dienstag, 9. Juli 2013 08:44:48 UTC+2 schrieb Bob Hanlon:
> 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
> 
> >
> 
> >

[toc] | [prev] | [standalone]


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


csiph-web