Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2011

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

Search the Archive

Re: plotting contours on a sphere [CORRECTION]

  • To: mathgroup at smc.vnet.net
  • Subject: [mg119485] Re: plotting contours on a sphere [CORRECTION]
  • From: Bob Hanlon <hanlonr at cox.net>
  • Date: Mon, 6 Jun 2011 06:23:36 -0400 (EDT)

This removes the boundary artifact.

p3 = SphericalPlot3D[1, {\[Phi], 0, Pi}, {\[Theta], 0, 2 Pi},
  ColorFunctionScaling -> False,
  ColorFunction -> Function[{x, y, z, \[Theta], \[Phi], r},
    ColorData["TemperatureMap"]
     [Rescale[f[\[Phi], \[Theta]], {-1, 1}]]],
  Mesh -> 9,
  MeshFunctions ->
   {Function[{x, y, z, \[Theta], \[Phi], r}, 
     f[\[Phi], \[Theta]]]},
  BoundaryStyle -> Transparent]


Bob Hanlon

---- Bob Hanlon <hanlonr at cox.net> wrote: 

=============

p3 = SphericalPlot3D[1, {\[Phi], 0, Pi}, {\[Theta], 0, 2 Pi},
  ColorFunctionScaling -> False,
  ColorFunction -> Function[{x, y, z, \[Theta], \[Phi], r},
    ColorData["TemperatureMap"]
     [Rescale[f[\[Phi], \[Theta]], {-1, 1}]]],
  Mesh -> 9,
  MeshFunctions ->
   {Function[{x, y, z, \[Theta], \[Phi], r}, 
     f[\[Phi], \[Theta]]]}]


Bob Hanlon

---- J Davis <texasautiger at gmail.com> wrote: 

=============
I would like to plot the contours of a given function f on the surface
of a sphere.

More specifically, I'd like to "wrap" the contours in p2 below onto
the surface of the sphere in p3.

f[\[Theta]_, \[Phi]_] = Sin[\[Theta] + \[Phi]];
p1 = Plot3D[f[\[Theta], \[Phi]], {\[Theta], 0, 2 Pi}, {\[Phi], 0, Pi},
    PlotRange -> All, AxesLabel -> {\[Theta], \[Phi]},
   ColorFunction -> ColorData["TemperatureMap"]];
p2 = ContourPlot[
   f[\[Theta], \[Phi]], {\[Theta], 0, 2 Pi}, {\[Phi], 0, Pi},
   PlotRange -> All, FrameLabel -> {\[Theta], \[Phi]},
   ColorFunction -> ColorData["TemperatureMap"]];
p3 = SphericalPlot3D[1, {\[Phi], 0, Pi}, {\[Theta], 0, 2 Pi},
   ColorFunctionScaling -> False,
   ColorFunction ->
    Function[{x, y, z, \[Theta], \[Phi], r},
     ColorData["TemperatureMap"][
      Rescale[f[\[Phi], \[Theta]], {-1, 1}]]]];
GraphicsRow[{p1, p2, p3}, ImageSize -> 750]

Thanks in advance for any insight you can offer.

Best,
John



  • Prev by Date: Re: Question about function construction
  • Next by Date: Re: Question about function construction
  • Previous by thread: Re: Is there ToNumber?
  • Next by thread: Re: How the final "typeset" expression of TableForm is generated?