6
$\begingroup$

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:

enter image description here

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

For instance, you can do the following:

Show[Graphics3D[
  MapThread[{Black, Arrow@Tube@{{0, 0, 0}, #1}, 
     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]]]

enter image description here

$\endgroup$
5
$\begingroup$
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
]

enter image description here

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

enter image description here

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
 ]

enter image description here


Refactored for brevity and with increased PlotPoints:

m = IdentityMatrix[3];

Show[

  Graphics3D[{
    Arrow[{{0, 0, 0}, #} & /@ m],
    FontSize -> 20,
    Thread@Text[{"X", "Y", "Z"}, 1.1 m]
  }],

  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
]

enter image description here

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.