# Plot contour lines on a sphere

I have this code to plot contours:

ContourPlot[(Cos[θ] Cos[ϕ])^(1/4), {θ, -π/2, π/2}, {ϕ, -π/2, π/2}, AxesLabel -> Automatic]


How would I map those contours on a unit sphere (if it is even possible) where θ and ϕ are the spherical angles for the sphere (θ is the inclination calculated from the xy plane and ϕ is azimuth calculated from the x-axis)?

In a post here, I saw a different problem and the suggestion was to use MeshFunctions so I tried:

ParametricPlot3D[{Sin[ϕ] Cos[θ],Cos[ϕ] Cos[θ],Sin[θ]},
{θ, -π/2, π/2}, {ϕ, -π/2, π/2},
MeshFunctions -> {
ContourPlot[(Cos[θ] Cos[ϕ])^(1/4), {θ, -π/2, π/2}, {ϕ, -π/2, π/2},
AxesLabel -> Automatic]
}]


but it spits errors and I do not even know whether this approach is correct.

EDIT: Corrected slot numbers per input from Simon Wood.

Look at the documentation for MeshFunctions

ParametricPlot3D[{Sin[ϕ] Cos[θ],
Cos[ϕ] Cos[θ],
Sin[θ]}, {θ, -π/2, π/2}, {ϕ, -π/
2, π/2}, MeshFunctions -> {(Cos[#4] Cos[#5])^(1/4) &},
PlotPoints -> 50]


• The parameters theta and phi are #4 and #5 in the mesh function. – Simon Woods Jan 16 '16 at 16:23

You could use SliceContourPlot3D:

expr = TransformedField["Spherical" -> "Cartesian",
(Cos[θ - π/2] Cos[ϕ])^(1/4), {r, θ, ϕ} -> {x, y, z}];

SliceContourPlot3D[expr, "CenterSphere", {x, -1, 1}, {y, -1, 1}, {z, -1, 1}]


The missing parts of the sphere are where your expression isn't real.

• Note that the OP's phi is not the traditional spherical phi: phi = 0 is the xy plane for the OP. At least that's how I read it before. – Michael E2 Jan 16 '16 at 17:00
• @MichaelE2, thanks, I hadn't spotted that. – Simon Woods Jan 16 '16 at 17:07