Career Path: Data Science
Section: Data Visualization
Sub-section: Graphing Cumulative Project
- I’d like to complete the suggestion in Step 5 (not included below) which was to potentially plot other stars, but having some difficulty locating coordinates for constellations. How are the x, y, and z coordinates inferred from the declination and right ascension?
- Any other feedback about how the below can be improved would also be appreciated!
- Referring to the project rubric, is there any grading that is based off of that (and, if so, is that tracked as an indicator of our progress in the ‘Data Science’ path?). Currently assuming it’s more of a guidepost to know what’s bad vs sufficient vs good in this project.
# allow visualization to be rotated %matplotlib notebook # importing relevant methods from matplotlib import pyplot as plt from mpl_toolkits.mplot3d import Axes3D
2. Get familiar with real data
Assign coordinates from the paper “The Orion constellation as an installation” (found here) to variables. The variables are named for the respective coordinate columns (x, y, z)
# Orion x = [-0.41, 0.57, 0.07, 0.00, -0.29, -0.32,-0.50,-0.23, -0.23] # column x[m] from documentation y = [4.12, 7.71, 2.36, 9.10, 13.35, 8.13, 7.19, 13.25,13.43] # column y[m] z = [2.06, 0.84, 1.56, 2.07, 2.36, 1.72, 0.66, 1.25,1.38] # column z[m]
3. Create a 2D Visualization
Taking a look at the star coordinates in 2D prior to looking at a 3D visualization.
# Create a figure, add a subplot to the figure by calling the add_subplot method, and plot the coordinates to that subplot. fig = plt.figure() fig.add_subplot(1,1,1) plt.scatter(x,y, color='blue', marker="*") # Adding labels plt.title('The Orion Constellation as an Installation: Star Coordinates (2D)') plt.xlabel('x[m] coordinates') plt.ylabel('y[m] coordinates') # Render the visualization. plt.show()
4. Create a 3D Visualization
Creating a 3D visualization using all available coordinates (x, y, and z)
# Create a figure and assign to a variable fig_3d, give the figure a 3D subplot, and plot all coordinates to that subplot. fig_3d = plt.figure() ax = fig_3d.add_subplot(1,1,1, projection='3d') constellation3d = plt.scatter(x, y, z, color='blue', marker="*") # Labelling axes and plot for readability ax.set_xlabel('x[m] coordinates') ax.set_ylabel('y[m] coordinates') ax.set_zlabel('z[m] coordiantes') plt.title('The Orion Constellation as an Installation: Star Coordinates (3D)') # Render the visualization plt.show(constellation3d)