MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: two graphs have different color on surface

  • To: mathgroup at smc.vnet.net
  • Subject: [mg95685] Re: two graphs have different color on surface
  • From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
  • Date: Sun, 25 Jan 2009 06:48:48 -0500 (EST)
  • Organization: The Open University, Milton Keynes, UK
  • References: <gleth7$4pe$1@smc.vnet.net>

In article <gleth7$4pe$1 at smc.vnet.net>,
 Steven Siew <stevensiew2 at gmail.com> wrote:

> I have tried to produce a graph where the color on the surface depends
> on the value of z. When I tried doing it in two different ways, the
> color are different on the two graphs even though as far as I can fee
> they should be the same. The code are as below
> 
> ComplexColorPlot[func_, {xmin_, xmax_}, {ymin_, ymax_},
>   opts___?OptionQ] := Module[{x, y},
>   Plot3D[Re[func[x + I y]], {x, xmin, xmax}, {y, ymin, ymax}, opts,
>    ColorFunction -> (ColorData["Rainbow"][
>        Re@func[#1 + I*#2]] &)     ]  ]
> 
> ComplexColorPlot2[func_, {xmin_, xmax_}, {ymin_, ymax_},
>   opts___?OptionQ] := Module[{x, y},
>   Plot3D[Re[func[x + I y]], {x, xmin, xmax}, {y, ymin, ymax}, opts,
>    ColorFunction -> (ColorData["Rainbow"][#3] &)     ]  ]
> 
> ComplexColorPlot[Sqrt, {-1, 1}, {-1, 1},
>  ViewPoint -> {1.227, -1.942, 3.028}, PlotPoints -> {50, 50}]
> 
> ComplexColorPlot2[Sqrt, {-1, 1}, {-1, 1},
>  ViewPoint -> {1.227, -1.942, 3.028}, PlotPoints -> {50, 50}]
> 
> I expect the functions ComplexColorPlot2 and ComplexColorPlot to
> produce identical color graphs when given identical inputs but they
> dont. And I'm at loss as to why they dont.
> 
> My ultimate objective is to have the color reflect the value of Im[func
> [x+I*y]] but I'm great difficulties in achieving it.

The issue might be due to color scaling, assuming that both color 
functions are really the same thing but written differently. Set the 
option ColorFunctionScaling to True or False in both plot functions to 
see how the graphs are rendered.

ComplexColorPlot[func_, {xmin_, xmax_}, {ymin_, ymax_}, 
  opts___?OptionQ] := 
 Module[{x, y}, 
  Plot3D[Re[func[x + I y]], {x, xmin, xmax}, {y, ymin, ymax}, opts, 
   ColorFunction -> (ColorData["Rainbow"][Re@func[#1 + I*#2]] &), 
   ColorFunctionScaling -> False]]

ComplexColorPlot2[func_, {xmin_, xmax_}, {ymin_, ymax_}, 
  opts___?OptionQ] := 
 Module[{x, y}, 
  Plot3D[Re[func[x + I y]], {x, xmin, xmax}, {y, ymin, ymax}, opts, 
   ColorFunction -> (ColorData["Rainbow"][#3] &), 
   ColorFunctionScaling -> False]]

ComplexColorPlot[Sqrt, {-1, 1}, {-1, 1}, 
 ViewPoint -> {1.227, -1.942, 3.028}, PlotPoints -> {50, 50}]

ComplexColorPlot2[Sqrt, {-1, 1}, {-1, 1}, 
 ViewPoint -> {1.227, -1.942, 3.028}, PlotPoints -> {50, 50}]

HTH,
--Jean-Marc


  • Prev by Date: Re: two graphs have different color on surface
  • Next by Date: Re: Mathematica Animation Drives Me Crazy!
  • Previous by thread: Re: two graphs have different color on surface
  • Next by thread: Re: two graphs have different color on surface