# How to plot a sphere with Cartesian coordinate axes?

I use this code:

ContourPlot3D[x^2 + y^2 + z^2 == 1, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}]


But I can not to see the coordinate axes inside the sphere like the following picture:

• Please clarify your question. Do you want your result to have arrows of coordinate axes from the origin, or something else? – kirma Aug 13 '16 at 7:48
• @kirma I want to have arrows of coordinate axes from the origin. – user37694 Aug 13 '16 at 7:50

For instance, you can do the following:

Show[Graphics3D[
Text[#2, #1, {0, -1}]} &, {2 IdentityMatrix[3], {x, y, z}}],
Boxed -> False],
ContourPlot3D[
x^2 + y^2 + z^2 == 1, {x, -1, 1}, {y, -1, 1}, {z, -1, 1},
ContourStyle -> Opacity[1/2]]]


Show[

Graphics3D@{Arrow[{{0, 0, 0}, {1, 0, 0}}]},
Graphics3D@{Arrow[{{0, 0, 0}, {0, 1, 0}}]},
Graphics3D@{Arrow[{{0, 0, 0}, {0, 0, 1}}]},

ContourPlot3D[
x^2 + y^2 + z^2 == .05,

{x, -1, 1}, {y, -1, 1}, {z, -1, 1},

ContourStyle -> {Green, Opacity[0.1]},
Mesh -> 1,
MeshStyle -> Red
],

Boxed -> False
]


Graphics3D@{Text[X, {1.1, 0, 0}]},
Graphics3D@{Text[Y, {0, 1.1, 0}]},
Graphics3D@{Text[Z, {0, 0, 1.1}]},


Show[

Graphics3D@{Arrow[{{0, 0, 0}, {1, 0, 0}}]},
Graphics3D@{Arrow[{{0, 0, 0}, {0, 1, 0}}]},
Graphics3D@{Arrow[{{0, 0, 0}, {0, 0, 1}}]},

Graphics3D@{Text[X, {1.1, 0, 0}]},
Graphics3D@{Text[Y, {0, 1.1, 0}]},
Graphics3D@{Text[Z, {0, 0, 1.1}]},

ContourPlot3D[
x^2 + y^2 + z^2 == .05,
{x, -1, 1}, {y, -1, 1}, {z, -1, 1},

ContourStyle -> {Green, Opacity[0.3], Specularity[1]},
Mesh -> 1,
MeshStyle -> Red
],

Boxed -> False
]


Refactored for brevity and with increased PlotPoints:

m = IdentityMatrix[3];

Show[

Graphics3D[{
Arrow[{{0, 0, 0}, #} & /@ m],
FontSize -> 20,
}],

ContourPlot3D[
x^2 + y^2 + z^2 == .05,
{x, -1, 1}, {y, -1, 1}, {z, -1, 1}
, ContourStyle -> {Opacity[0.3, Green], Specularity[1]}
, Mesh -> 1
, MeshStyle -> Red
, PlotPoints -> 40
]
, Boxed -> False
]


• @Mr.Wizard me likey those increased PlotPoints – Conor Cosnett Aug 14 '16 at 10:48