Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Topic: wrap a density plot on a sphere
Replies: 1   Last Post: Nov 11, 2013 11:29 PM

 Bob Hanlon Posts: 906 Registered: 10/29/11
Re: wrap a density plot on a sphere
Posted: Nov 11, 2013 11:29 PM

Did you create an interpolation function from your data?

data = Flatten[Table[{t, p, Sqrt[p^2 + t^2]},
{t, 0, 2 Pi, Pi/16}, {p, 0, Pi, Pi/32}], 1];

f = Interpolation[data];

SphericalPlot3D[1,
{t, 0, 2 Pi}, {p, 0, Pi},
ColorFunction ->
Function[{x, y, z, t, p, r}, Hue[f[t, p]]],
Mesh -> 10,
MeshFunctions ->
{Function[{x, y, z, t, p, r}, f[t, p]]}]

Comparing with the original function

SphericalPlot3D[1,
{t, 0, 2 Pi}, {p, 0, Pi},
ColorFunction ->
Function[{x, y, z, t, p, r}, Hue[Sqrt[p^2 + t^2]]],
Mesh -> 10,
MeshFunctions ->
{Function[{x, y, z, t, p, r}, Sqrt[p^2 + t^2]]}]

Bob Hanlon

On Mon, Nov 11, 2013 at 12:05 AM, Danny Barker <danny.barkan@gmail.com>wrote:

> Dear all
>
> I have a data set in the form of a list: {
> {Theta1,Phi1,f1},{Theta2,Phi2,f2}, ... } which i would like to present as a
> density/Contour plot on the surface of a sphere
>
> i read past posts and tried using
>
> SphericalPlot3D[1, {t, 0, 2 Pi}, {p, 0, Pi},
> ColorFunction -> Function[{x, y, z, t, p, r}, Hue[f[t, p]]],
> Mesh -> 10, MeshFunctions -> {Function[{x, y, z, t, p, r}, f[t, p]]}]
>
> but can't seem to get it right...
>