Mar-22-2019, 12:50 PM
You can try to continue with the following piece of code:
i
animation using Matplotlib, but it is not primarily designed for this.
i
mport matplotlib.pyplot as plt # ---------- Constants ---------- SCALE = 10**6 EARTH_RADIUS = 6378000 / SCALE MOON_RADIUS = 1737000 / SCALE MOON_DIST = 384e6 / SCALE # ------------------------------- fig = plt.figure() ax = fig.add_subplot(111) Earth = plt.Circle((0, 0), EARTH_RADIUS, color='g', label = 'Earth') Moon = plt.Circle((0, MOON_DIST), MOON_RADIUS, color ='r', label='Moon') ax.add_artist(Moon) ax.add_artist(Earth) plt.xlabel('x-position (Mm)') plt.ylabel('y-position (Mm)') plt.xlim(-10 ** 7 / SCALE, 10**8 / SCALE) plt.ylim(-10 ** 7 / SCALE, 4* 10**8 / SCALE) ax.set_aspect('equal') plt.grid() plt.show()AFAIK, Matplotlib is designed to make publication ready figures. It is possible to create
animation using Matplotlib, but it is not primarily designed for this.