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


Groups > comp.soft-sys.math.mathematica > #2976

Re: plotting contours on a sphere

From Heike Gramberg <heike.gramberg@gmail.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: plotting contours on a sphere
Date 2011-06-06 10:24 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <isi9tl$m1d$1@smc.vnet.net> (permalink)

Show all headers | View raw


You could use Texture in combination with TextureCoordinateFunction for this:

p2a = ContourPlot[
   f[\[Theta], \[Phi]], {\[Theta], 0, 2 Pi}, {\[Phi], 0, Pi}, 
   FrameLabel -> {\[Theta], \[Phi]}, 
   ColorFunction -> ColorData["TemperatureMap"],
   Axes -> False, Frame -> False, ImagePadding -> None,
   PlotRangePadding -> None];

p3 = SphericalPlot3D[1, {\[Theta], 0, Pi}, {\[Phi], 0, 2 Pi},
  Mesh -> None, PlotPoints -> 40,
  PlotStyle -> {Texture[p2a]},
  TextureCoordinateFunction -> ({#5, 1 - #4} &)]


Heike

On 5 Jun 2011, at 12:04, J Davis 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
> 

Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

Re: plotting contours on a sphere Heike Gramberg <heike.gramberg@gmail.com> - 2011-06-06 10:24 +0000

csiph-web