Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I made this Graphics3D of the Sun with the plotted orbits of a few astronomical objects.

otherCelestials = AstronomicalData["MinorPlanet"][[;; 10]];
  {Yellow, Sphere[AstronomicalData["Sun", "Position"], 0.05]},
  AstronomicalData[#, "OrbitPath"] & /@ otherCelestials
  }, Axes -> True, SphericalRegion -> True]

enter image description here

I would like it to rotate around the sphere representing the sun's position though. At the moment the ViewCenter is somewhere next to the sun, which means that when you rotate the plot, it rotates around that point and not the sun. How can I make it so that it rotates around the sun?

(The obvious thing to do would be set the ViewCenter of the plot to the coordinates of the sun, but in this case the sun's coordinates are given as {0, 0, 0}, but that just makes the ViewCenter point to the corner of the graph.)

share|improve this question
Yes I did, and I also just tried ViewCenter -> {{0.5, 0.5, 0.5}, {0.5, 0.5, 0.5}} to see whether that would make a difference, but neither of them did. – Aron Apr 18 '14 at 16:11
up vote 6 down vote accepted

Please tell me if this meets your needs, I feel it does:

Graphics3D[{{Yellow, Sphere[AstronomicalData["Sun", "Position"], 0.05]}, 
          AstronomicalData[#, "OrbitPath"] & /@ otherCelestials}, 
          Axes -> True, SphericalRegion -> True, 
          ViewVector -> {{1, -2, 1}, {0, 0, 0}}]

enter image description here

 Graphics3D[{{Yellow, Sphere[AstronomicalData["Sun", "Position"], 0.05]}, Thick, 
   AstronomicalData[#, "OrbitPath"] & /@ otherCelestials}, 
  SphericalRegion -> True, ViewVector -> {2.5 {Cos@t, Sin@t, 1}, {0, 0, 0}}, 
  ViewVertical -> {0, 0, 1}, ViewAngle -> 1, BaseStyle -> 18]
 {t, 0, 2 Pi, .1}]

enter image description here

share|improve this answer
Thank you, @Kuba this actually does exactly what I was looking for. It's just very confusing when ViewPoint uses scaled coordinates and ViewVector uses ordinary coordinates... Btw for some reason this doesn't actually work for another Graphics3D that I'm working on but that's a matter for another question – Aron Apr 20 '14 at 2:03
@Aron Yes, I didn't realised it either when you first asked about ViewCenter etc. So thank you, now I'm aware of the difference :) Maybe you can describe shortly your setup here, I mean this one where this solution does not work. – Kuba Apr 20 '14 at 7:01
Well in short, I have a very similar, albeit more elaborate setup with planets and their orbits around the sun, with sliders that control the zoom and rotation around the sun. For some reason though, although the rotation works and even seems to be focused on the sun, it seems to follow a highly elliptical orbit around the sun. Since I am using the exact same parametric function to control the ViewVector I don't know why it is behaving differently – Aron Apr 20 '14 at 13:35
@Aron Is ViewAngle fixed? – Kuba Apr 20 '14 at 14:08
Yes, it is fixed at 35 degrees. Since I'm new here, would the best practice be to edit my question and add this other problem in with it, or is it better to create a new question for this? – Aron Apr 20 '14 at 15:09

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.