Hello,
Please review my Orion Constellation Project. I used some of the other suggestions on this forum for formatting, etc, but I was able to add something of my own, which was labeling each star. I believe that the labels are correct, but I was not really able to adjust the 3D map to match the typical “shape” of the constellation that we see from the ground (or the initial image from the project — below). Any feedback would be welcome. Thanks for taking a look!
Setting the coordinates and names of each star (used the following links to figure out the name of each star:
Orion Coordinates from study
Orion Constellation Wikipedia
# Orion
x = [-0.41, 0.57, 0.07, 0.00, -0.29, -0.32,-0.50,-0.23, -0.23]
y = [4.12, 7.71, 2.36, 9.10, 13.35, 8.13, 7.19, 13.25,13.43]
z = [2.06, 0.84, 1.56, 2.07, 2.36, 1.72, 0.66, 1.25,1.38]
star_names = ['Betelgeuse','Rigel','Bellatrix','Mintaka','Alnilam','Alnitak','Saiph','Iota Orionis','Orion Nebula']
2D visualization:
fig = plt.figure()
constellation = fig.add_subplot(1,1,1)
constellation.scatter(x,y, marker = '*', color = 'yellow')
constellation.set_facecolor('xkcd:black')
def star_annotations(x, y, star, const):
for i in range(len(x)):
const.annotate(star[i], (x[i],y[i]), color = 'white')
star_annotations(x, y, star_names, constellation)
constellation.set_title('2D plot of Orion Constellation')
constellation.set_xlabel('Orion X coord')
constellation.set_ylabel('Orion y coord')
plt.show()
3D visualization:
fig_3d = plt.figure()
constellation3d = fig_3d.add_subplot(1,1,1, projection="3d")
constellation3d.scatter(x,y,z, marker = '*', color = 'yellow')
constellation3d.set_facecolor('xkcd:black')
constellation3d.set_xlabel('Orion X coord')
constellation3d.set_ylabel('Orion Y coord')
constellation3d.set_zlabel('Orion Z coord')
# naming the stars
def star_annotations3d(x, y, z, star, const):
for i in range(len(x)):
const.text(x[i],y[i],z[i], star[i], color = 'white')
star_annotations3d(x, y, z, star_names, constellation3d)
plt.title('3D map of Orion Constellation')
plt.gca().patch.set_facecolor('white')
constellation3d.w_xaxis.set_pane_color((0, 0, 0, 1.0))
constellation3d.w_yaxis.set_pane_color((0, 0, 0, 1.0))
constellation3d.w_zaxis.set_pane_color((0, 0, 0, 1.0))
plt.show()
Thanks!