79605392

Date: 2025-05-04 07:50:48
Score: 0.5
Natty:
Report link

Optimized version of your code:

from astroquery.jplhorizons import Horizons
from astropy.time import Time
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D

fig = plt.figure()
ax = plt.axes(projection='3d')

D=10000

start_time = Time("1986-08-06 11:08:00")
end_time = start_time + D

start_iso = start_time.isot
end_iso = end_time.isot

query = Horizons(
    id=3,  # Earth
    location="500@0",  # Solar system barycenter
    epochs={'start': start_iso, 'stop': end_iso, 'step': '1d'}
)

vec = query.vectors()

x = vec['x']
y = vec['y']
z = vec['z']

ax.scatter(x, y, z, s=10, c='blue', alpha=0.6, label='Position')

ax.set_xlabel("X (AU)")
ax.set_ylabel("Y (AU)")
ax.set_zlabel("Z (AU)")

plt.show()

enter image description here

Reasons:
  • Probably link only (1):
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: asat