Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Currently, I have a matrix containing a list of spherical coordinates. Column 1 is r; r=1 for all points. Column 2 is theta and column 3 is phi. Each row is an ordered triple (r,theta,phi). Is there a function that I can get to operate on this matrix and plot these points on a sphere of radius 1? Thank you!


share|improve this question
Transform the coordinates to Cartesian form, then use ListPointPlot3D. –  Szabolcs Jul 17 '14 at 15:13
Could you share your points? –  Mark McClure Jul 17 '14 at 15:13
@MarkMcClure My points are constantly changing as they're based upon roots of different polynomials. One example would be (1, pi/2, pi/4). –  Chase Yetter Jul 17 '14 at 15:21
@Szabolcs I think I'll combine your command with George's command. Will ListPointPlot3D apply to a matrix of triples? –  Chase Yetter Jul 17 '14 at 15:23
@ChaseYetter ListPointPlot3D can accept a matrix but that is probably not what you want: it will interpret each row as a separate sequence of points, and give them a different color. You can use Flatten[matrix, 1] to turn it into a list of points. –  mfvonh Jul 17 '14 at 15:42

2 Answers 2

 CoordinateTransformData[ "Spherical" -> "Cartesian", "Mapping", #]&/@ datalist


 Graphics3D@{Sphere[{0, 0, 0}, .95], 
    Point[CoordinateTransformData["Spherical" -> "Cartesian", 
           "Mapping", #] & /@ 
          Table[ { 1, RandomReal[{0, Pi}], RandomReal[{-Pi, Pi}]}, {2000}]]}

enter image description here

It may also be useful to see how you can roll your own:

 sp[{r_, theta_, phi_}] := 
      r {Cos[phi] Cos[theta], Cos[phi] Sin[theta], Sin[phi]};
 Graphics3D@{Sphere[{0, 0, 0}, .95],
 Point[ sp /@ Table[ { 1, RandomReal[{0, 2 Pi}], RandomReal[{-Pi/2, Pi/2}]}, {2000}]]}

(same graphic)

note here I use a different convention on the ordering of the spherical coordinates and and the range of theta.

share|improve this answer
Thanks @george2079 –  Chase Yetter Jul 17 '14 at 15:24

You can transform all your data points to xyz and plot them.

data = Flatten[Table[{1, theta, phi}, {phi, 0, 2 Pi, Pi/10.}, {theta, 0, Pi, 
 Pi/10.}], 1]; (*your set of data*)

rtox[sphdata_] := sphdata /. {r_, theta_, phi_} -> CoordinateTransform["Spherical" -> "Cartesian", {r, theta, phi}]
(*to change your table to cartesian from spherical*)

ListPointPlot3D[rtox[data], BoxRatios -> 1]

And your are done.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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