# ContourPlot3D in spherical coordinates

Is it possible to define/code a new plot in 3D directly using Spherical coordinates imagined to be somewhat like:

ContourPlot3Dsph[{f[r,theta,phi]==0}, {phi,.5,3}, {theta,0,3}, {r,1,2}]


Although we may convert from Cartesian coordinates, the advantage would be to see surface with net of parametric lines $$\phi= c_1, \theta=c_2, r= c_3$$ varied. It helps slightly better visualization of surface radial buildup due to $$r$$ variation, or so I feel.

EDIT1:

i.e., while visualizing the surface I want to be able to see Gridlines/Net defined on spherical coordinates, but not as the usual slices of Cartesian cuts.The parametric lines are a set of cones having common vertex at origin $$\phi$$, a set of meridians $$\theta$$, a set of sphere radii $$r$$.

• You can use the substitution ro=Sqrt[x^2+y^2+z^2], fi=... putting these formulas directly inside the f(...). It will be like f(Sqrt[..],ArcTan[..], ArcTan[..]) and it will work with usual ContourPlot3D where the variables are {x,x0,x1}, {y,y0,y1},{z,z0,z1}. Jun 27, 2018 at 7:41
• You can post a new question and someone should post another answer. BTW,edit2 should be a surface instead of solid. Aug 12, 2021 at 4:53
• Thanks , posting separately as per your suggestion. Aug 13, 2021 at 22:04

You only need define mesh functions for spherical coordinates.

For r:

ContourPlot3D[x + y - z == 1, {x, -1, 1}, {y, -1, 1}, {z, -1, 1},
Mesh -> {{.8, 1, 1.3}}, MeshStyle -> Thick,
MeshFunctions -> {Function[{x, y, z}, Sqrt[x^2 + y^2 + z^2]]}]


For phi and theta:

ContourPlot3D[
x^2 + y^2 + z^2 == 1, {x, -1, 1}, {y, -1, 1}, {z, -1, 1},
Mesh -> {{0 Degree, 10 Degree, -70 Degree}}, MeshStyle -> Thick,
MeshFunctions -> {Function[{x, y, z}, ArcTan[x, y]]}]

ContourPlot3D[
x^2 + y^2 + z^2 == 1, {x, -1, 1}, {y, -1, 1}, {z, -1, 1},
Mesh -> {{20 Degree, 90 Degree, 120 Degree}}, MeshStyle -> Thick,
MeshFunctions -> {Function[{x, y, z}, ArcTan[z, Sqrt[x^2 + y^2]]]}]


With additional RegionFunction, you can e.g. restrict for 60 Degree < theta < 150 Degree

ContourPlot3D[x + y - z == 1, {x, -1, 1}, {y, -1, 1}, {z, -1, 1},
Mesh -> {{.8, 1, 1.3}}, MeshStyle -> Thick,
MeshFunctions -> {Function[{x, y, z}, Sqrt[x^2 + y^2 + z^2]]},
RegionFunction ->
Function[{x, y, z},
60 Degree < ArcTan[z, Sqrt[x^2 + y^2]] < 150 Degree]]

• When only $\phi, \theta$ are parametrized we have a surface.When $r, \phi, \theta$ are parametrized we have a solid, or hollow solid.if meshed. Jun 28, 2018 at 9:13