The following code renders a sphere and a plane. How do I get the plane to be at the south pole of the sphere - and centered? On this diagram, I would like to draw a ray from the north pole N through the point P = (-\sqrt{3}, -1/\sqrt{2},-1/\sqrt{2}) and through the point Q = ((-\sqrt{3}/7)(-8+2\sqrt{2}), (-\sqrt{2}/14)(-8+2\sqrt{2}), -2) of intersection between the ray and the plane, and I would like to mark N, P, and Q with a dot. (I want to keep the code in a TikZ environment.)






\shade[ball color=blue!25] (0,0,0) circle (2);
\fill[opacity=0.25] (-3,0,4) -- (-1,2,4) -- (5,2,4) -- (3,0,4) -- cycle;


  • 2
    Tikz uses a painter's algorithm for drawing, what is written (in code) first is drawn first and code afterwards is drawn on top. For positioning, x and y are on the paper, z goes into the paper; so you have to re-order your coordinates to make it work. So (0,-2,0) would be the south pole of your sphere; (-2,-2,-2) the left front corner. This code: \fill[opacity=0.25] (-2,-2,-2) -- (2,-2,-2) -- (2,-2,2) -- (-2,-2,2) -- cycle; \shade[ball color=blue!25] (0,0,0) circle (2); should get you going.
    – Huang_d
    Commented Oct 26, 2017 at 16:18
  • If you prefer the axis to point in other directions you can easily change the definitions as shown here.
    – jakun
    Commented Oct 27, 2017 at 5:41
  • I am interested in drawing the ray from 'N' through 'P' and 'Q'.
    – user74973
    Commented Oct 27, 2017 at 11:07
  • If you look in the pgfmath section of the tikz manual, you will see that it use sqrt(3) instead of \sqrt{3}. Other than that, it should work for \coordinate or \fill[black] circle(2pt) node[above right]{P}; etc. Commented Oct 28, 2017 at 14:40
  • @John Kormylo I was stating the ray that I wanted using TeX commands. I know that to code in TikZ, the coordinates would be specified with commands like sqrt(3) and -1/sqrt(2).
    – user74973
    Commented Oct 29, 2017 at 17:46

1 Answer 1


This example could be useful to you: http://texample.net/tikz/examples/map-projections/ .

  • Is it too long as a comment? Commented Oct 29, 2017 at 13:17
  • No, @ArtificialStupidity. I'm still not allowed to comment other people's answers (because I didn't reach 50 yet). But (since I was studying the example from the link I have posted) I thought it could be helpful to answer user7493's question. If this is considered inappropriate by the community, I can delete my answer.
    – Alex
    Commented Oct 29, 2017 at 13:27
  • @Alex Yes, the code of one of these drawings is what I want.
    – user74973
    Commented Nov 1, 2017 at 22:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .