       Re: wrap a density plot on a sphere

• To: mathgroup at smc.vnet.net
• Subject: [mg131994] Re: wrap a density plot on a sphere
• From: Bob Hanlon <hanlonr357 at gmail.com>
• Date: Tue, 12 Nov 2013 00:16:30 -0500 (EST)
• Delivered-to: l-mathgroup@mail-archive0.wolfram.com
• Delivered-to: l-mathgroup@wolfram.com
• Delivered-to: mathgroup-outx@smc.vnet.net
• Delivered-to: mathgroup-newsendx@smc.vnet.net
• References: <20131111050532.DBDCD6A22@smc.vnet.net>

```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 at 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...
>