Skip to content

Instantly share code, notes, and snippets.

@cvschwrtz
Created July 21, 2021 23:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cvschwrtz/94648bd89d88309e77c7a8e85f9179df to your computer and use it in GitHub Desktop.
Save cvschwrtz/94648bd89d88309e77c7a8e85f9179df to your computer and use it in GitHub Desktop.
CodeAcademy
%matplotlib notebook
from matplotlib import pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
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]
fig_2d = plt.figure()
ax = fig_2d.add_subplot(1, 1, 1)
plt.scatter(x,y, color = 'yellow', marker = '*')
plt.title('2D Visualization of the Orion Constellation')
plt.xlabel('\'x\' Coordinates')
plt.ylabel('\'y\' Coordinates')
ax.set_facecolor('xkcd:black')
plt.show()
fig_3d = plt.figure()
constellation3d = fig_3d.add_subplot(1, 1, 1, projection = '3d')
constellation3d.scatter(x, y, z, color = 'yellow', marker = '*', s = 50)
plt.title('3D Visualization of the Orion Constellation')
constellation3d.set_xlabel('\'x\' Coordinates')
constellation3d.set_ylabel('\'y\' Coordinates')
constellation3d.set_zlabel('\'z\' Coordinates')
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()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment