Orion Constellation Project- Datascience Path

Submiting my project on Datascience Path. Glad to hear any comments and suggestions to make it better.

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

Orion Constellation - 2D

fig = plt.figure()
ax_2d=fig.add_subplot(1,1,1)
plt.scatter(x,y)
plt.title(“2D Orion Constellation”)
ax_2d.set_xlabel(“X-Coordinate”)
ax_2d.set_ylabel(“Y-Coordinate”)
plt.show()

Orion_2D

Orion Constellation - 3D

fig_3d = plt.figure()
ax_3d=fig_3d.add_subplot(1,1,1,projection=“3d”)
constellation3d = plt.scatter(x,y,z, color=“purple”, marker="*")
plt.title(“3D Orion Constellation”)
ax_3d.set_xlabel(“X-Coordinate”)
ax_3d.set_ylabel(“Y-Coordinate”)
ax_3d.set_zlabel(“Z-Coordinate”)
plt.show()

Orion

It’s not a project I’ve tried but it seems nice and clear to me, everything’s labelled.

If you’re hunting for absolutely any suggestions I’d say try to be consistent with your use of figure/axis references. Occaionally you swap between plt methods and methods assigned to a particular instance (I’d always advocate for the second).
So ax_3d.scatter instead of plt.scatter, same for titles/labels.

@tgrtim, Thanks for giving me your valuable time and feedback. I absolutely value all feedback so that I can develop best practice code discipline. I have already updated the code in my jupyter notebook as you suggested, and I too like the consistency now. Thanks again.

1 Like