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


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

Re: plotting contours on a sphere

Started byBob Hanlon <hanlonr@cox.net>
First post2011-06-06 10:23 +0000
Last post2011-06-07 10:47 +0000
Articles 2 — 2 participants

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


Contents

  Re: plotting contours on a sphere Bob Hanlon <hanlonr@cox.net> - 2011-06-06 10:23 +0000
    Re: plotting contours on a sphere "Nasser M. Abbasi" <nma@12000.org> - 2011-06-07 10:47 +0000

#2977 — Re: plotting contours on a sphere

FromBob Hanlon <hanlonr@cox.net>
Date2011-06-06 10:23 +0000
SubjectRe: plotting contours on a sphere
Message-ID<isi9qb$lqm$1@smc.vnet.net>
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@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



[toc] | [next] | [standalone]


#2993

From"Nasser M. Abbasi" <nma@12000.org>
Date2011-06-07 10:47 +0000
Message-ID<iskvjs$5qd$1@smc.vnet.net>
In reply to#2977
On 6/6/2011 3:23 AM, Bob Hanlon 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
>

Hi Bob;

what version of Mathematica did you use? on 8.0.1,
windows 7, I get an error message.

MeshFunctions::invmeshf: MeshFunctions->{At Line = 1, the input
was:,p3=SphericalPlot3D[1,{\[Phi],0,Pi},{\[Theta],0,2Pi},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]]]}],f[#5,#4]&} must be a pure function or a list of pure functions. >>

here is a screen shot also fyi

http://12000.org/tmp/june_5_2011/msg.png

--Nasser

[toc] | [prev] | [standalone]


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


csiph-web