Z-values on a sphere

Building a color function

If we have a function z = f(x, y) we can scale the function so the region of interest falls in the region defined by -π < x < π and -π/2 < y < π/2.  Then since color functions such as Hue require the values fed to them fall between 0 and 1 we need to scale the function so the z values fall in that range.  The follow is a function which satisfies those requirements.

f1[x_, 
        y_]  :=  (Sin[ (x^2) (y^2)/2]  +  Cos[ (x^2) (y^3)/3] + 2)/
          5  +   .1

A standard plot of this function gives some idea of its form.

Plot3D[f1[x, y], {x, -π,  π}, {y, -π/2, π/2}, 
      PlotPoints  -> 80, BoxRatios  ->  {2 π, π, 1/2}, 
      PlotRange  ->  All]

We can get some idea of how our color function will be rendered by using the ColorFunction in Plot3D.

Plot3D[f1[x, y], {x, -π,  π}, {y, -π/2, π/2}, 
      PlotPoints  -> 80, BoxRatios  ->  {2 π, π, 1}, 
      PlotRange  ->  All, ColorFunction  -> ( Hue[#] &), 
      Lighting  ->  False, Mesh  ->  False]

Putting this on a sphere

To put this on a sphere as a color map we use ParametricPlot3D adding  color as part of the fourth argument in the tuple.  We can take the sphere plot from the HelpBrowser 1.9.10.  I have chosen the viewpoint to see the most interesting part of the plot.  I have also removed the outlines for the polygons using EdgeForm[ ] as part of the fourth argument in the tuple.  I have also change the plot values from those in the book example to correspond to the boundries of our function.

ParametricPlot3D[{Cos[t] Cos[u], Sin[t] Cos[u], 
        Sin[u], {EdgeForm[], 
          Hue[f1[t, u]]}}, {t, -π, π}, {u, -π/2, π/
          2}, Lighting  ->  False, PlotPoints  ->  {140, 70}, 
      ViewPoint -> {-2.806,  -1.487,  1.168}]