MathGroup Archive 2004

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

Search the Archive

RE: color in SphericalPlot3D

  • To: mathgroup at
  • Subject: [mg48020] RE: [mg47997] color in SphericalPlot3D
  • From: "Wolf, Hartmut" <Hartmut.Wolf at>
  • Date: Fri, 7 May 2004 04:29:39 -0400 (EDT)
  • Sender: owner-wri-mathgroup at
  • Thread-topic: [mg47997] color in SphericalPlot3D

>-----Original Message-----
>From: Maurits Haverkort [mailto:Haverkort at]
To: mathgroup at
>Sent: Wednesday, May 05, 2004 2:11 PM
>To: mathgroup at
>Subject: [mg48020] [mg47997] color in SphericalPlot3D
>Dear All
>I have a complex function R(t_,f_) of wich I would like to plot
>R*Conjugate[R] in 3D. So far no problem, SphericalPlot3D does 
>this for me.
>But I want to conserve phase information, wich I want to put 
>in the color.
>(positive red, negative blue, complex purple). For Real 
>functions R(t_,f_) I
>made the folowing notebook that does not work. It should plot first the
>function for R>0 in red and then the part for R<0 in blue. 
>After combining
>the two plots with show everything is blue. Has this problem 
>been solved
>before? Does anybody know how to asign a color to the surface 
>of a Spherical
>3D plot?
>R = FullSimplify[SphericalHarmonicY[2, 2, t, f] + 
>SphericalHarmonicY[2, -2,
>t, f]];
>plotpos = SphericalPlot3D[If[R >= 0, R Conjugate[R], 0], {t, 
>0, \[Pi]}, {f,
>0, 2\[Pi]}, LightSources -> {{{1, 1, 1}, RGBColor[1, 0, 0]}}];
>plotneg = SphericalPlot3D[If[R <= 0, R Conjugate[R], 0], {t, 
>0, \[Pi]}, {f,
>0, 2\[Pi]}, LightSources -> {{{1, 1, 1}, RGBColor[0, 0, 1]}}];
>Show[plotneg, plotpos]
>Maurits Haverkort

It's quite simple, as SphericalPlot3D descends from ParametricPlot3D, its retains the optional style component, e.g.:

<< Graphics`ParametricPlot3D`
<< Graphics`ArgColors`

  Evaluate[Through[{Abs, ArgColor}[
            SphericalHarmonicY[2, 1, theta, phi] ]]],
     {theta, 0., Pi}, {phi, 0., 2 Pi},
     Lighting -> False, PlotPoints -> 50]

You must, however, turn the Lighting off.

Hartmut Wolf

  • Prev by Date: Re: color in SphericalPlot3D
  • Next by Date: Expression comparison in Mathematica
  • Previous by thread: Re: Problems with Latex (Windows) and Mathematica 5.0
  • Next by thread: Expression comparison in Mathematica