# Orion Constellation Project

Hi everyone,
Here is my first project submitted to Codecademy.
Please let me know if there is any issue to fix.

``````%matplotlib notebook
from matplotlib import pyplot as plt
from mpl_toolkits.mplot3d import Axes3D

# 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]

#2d figure
fig = plt.figure()
plt.title('Orion constellation 2D graphic')
plt.scatter(x, y, color='red')
plt.show()

#3d figure
fig_3d = plt.figure()
constellation3d = fig_3d.add_subplot(1, 1, 1, projection='3d')
plt.title('Orion constellation 3D graphic')
constellation3d.scatter(x, y, z, color='green')
plt.show()
``````

It all looks sensible to me but consider adding some labels to your axes. Without them what youāre actually plotting isnāt as clear. Ideally someone else could view the figure and be able to understand it without having to read masses of accompanying text. Itās not always possible but you should be aiming towards that whenever possible.

It is interesting that Z axes canāt be labelled by using `plt.zlabel()`
I have to label them in this way:

``````%matplotlib notebook
from matplotlib import pyplot as plt
from mpl_toolkits.mplot3d import Axes3D

# 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]

#2D figure
fig = plt.figure()
plt.title('Orion constellation 2D graphic')
plt.xlabel('Right ascension')
plt.ylabel('Declination')
plt.scatter(x, y, color='red')
plt.show()

#3D figure
fig_3d = plt.figure()
constellation3d = fig_3d.add_subplot(1, 1, 1, projection='3d')
plt.title('Orion constellation 3D graphic')
constellation3d.scatter(x, y, z, color='green')
constellation3d.set_zlabel('Distance')
constellation3d.set_xlabel('Right ascension')
constellation3d.set_ylabel('Declination')
plt.show()
``````

Hope I have not put any label on wrong axes.

1 Like

I think plt.zlabel isnāt included as a wrapper function because most of the plots are designed for 2D and plt.zlabel would be liable to throw errors. Better to leave the labelling to the methods assigned to the 3D object which is good practice in OOP anyway. As for the labels I think youād need to check the original paper (linked in the .ipynb file), I believe the co-ordinates are converted to Cartesian rather than being left as right angle/declination and distance.

I think Iām quite confused about the Origin coordinate given in the project.

According to this article in Wiki, if I see equator as the X axes, and celestial pole as Y axes, then the āright ascensionā is similar to X axes, and ādeclinationā is also like Y axes. So the Z axes can only be the third coordinate which is ādistanceā.

Also in the project paper 2nd paragraph, it mentioned declination is similar to longitude, and right ascension is known as the āhour angleā which can only be X axes.

Iām not sure what does these coordinate mean in the project, and this is my first time bump into a celestial concept. Quite challenging, but fun.