Orion Constellation Project

Hello there! This is my Orion Constellation Project! I was able to have fun plotting Leo as well from the given star database. As a new user, I’m only able to post one image, so I included 3D Orion for comparability. Any feedback would be greatly appreciated!

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

Orion Coordinates

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 Orion

fig = plt.figure()
ax = fig.add_subplot(1,1,1)
ax.set_xlabel(“X-Coordinate”)
ax.set_ylabel(“Y-Coordinate”)
plt.scatter(x,y, color = “red”, marker = “*”)
plt.title(“Map of Orion in 2D”)
plt.show()

3D Orion

fig_3d = plt.figure()
ax_3d = fig_3d.add_subplot(1, 1, 1, projection = ‘3d’)
constellation3d = ax.scatter(x, y, z, s = 50, color = “red”, marker = “*”)
plt.title(“Map of Orion in 3D”)
ax_3d.set_xlabel(“X-Coordinate”)
ax_3d.set_ylabel(“Y-Coordinate”)
ax_3d.set_zlabel(“Z-Coordinate”)
plt.show()

3D Leo Coordinates

x_leo = [-67.0, -34.97, -53, -86, -83.4, -13.5, -59, -7.416, -61.4, -57, -72.2]
y_leo = [35.5, 1.671, 10.7, 9.66, 48.1, 6.53, 27.6, 2.193, 29.5, 8.32, 8.95]
z_leo = [16.1, 9.102, 20.2, 4.62, 44.0, 5.50, 23.0, 0.993, 29.1, 3.03, 18.6]

Plotting 3D Leo

fig_leo = plt.figure()
ax_leo = fig_leo.add_subplot(1, 1, 1, projection = “3d”)
ax_leo.scatter(x_leo, y_leo, z_leo, s = 50, color = “orange”, marker = “*”)
plt.title(“Map of Leo Constellation in 3D”)
ax_leo.set_xlabel(“X-Coordinate”)
ax_leo.set_ylabel(“Y-Coordinate”)
ax_leo.set_zlabel(“Z-Coordinate”)
plt.show()

2 Likes

It looks perfect, I’ve just finished this project but I cannot find a way to download a 3d version of the Orion constellation image that can be reshaped or moved. Did you?

I didn’t try very hard to download an interactive image sort of thing, I just pressed the sort of stop button top right and saved the still image. Cheers!

Hi,
I do not quit get why I can not manipulate size of the “stars”.
I get error:

---> 7 constellation3d=plt.scatter(x,y,z,s=500,marker='*')
      8 plt.title('Constellation Orion')
      9 

TypeError: scatter() got multiple values for argument 's'

It works if I remove “s=xxx”

My Code:

fig_3d=plt.figure()
ax=fig_3d.add_subplot(1,1,1,projection="3d")
constellation3d=plt.scatter(x,y,z,marker='*')
#constellation3d=plt.scatter(x,y,z,s=500,marker='*') <== Why s as size control is not working?
plt.title('Constellation Orion')

ax.set_xlabel('X Label')
ax.set_ylabel('Y Label')
ax.set_zlabel('Z Label')
plt.show()

I think the way you have it coded there gives you a scatter function from the wrong library which is why it doesn’t work.
If you look in my code, I have the scatter function acting on the axis object (I just noticed it should be):
ax_3d.scatter()
where you have it as plt.scatter()

Hopefully that works for you! Cheers!

Hi, Thanks it works now.
But to be honest, I don’t quite understand what this `ax_3d’ is doing?

An why then we are going on to create ‘constellation3d’ ?

I think the constellation3d is completely unnecessary for this project, I guess they’re just showing you that you can do that

1 Like