Orion Constellation Project for Review

Hi Everyone,

Here is a link to my Orion Constellation Project. https://github.com/CSorrel58/personal_projects/blob/master/clinton_constellation.ipynb

Please let me know what you think and don’t hold back!

Congrats on finishing up. It’s hard to see from your figure but I think you may have fallen into the trap of using the standard matplotlib.pyplot.scatter function which only plots in 2D. You need to be using the .scatter method of the Axes3D object to get a proper z-axis value.

ax3d = fig_3d.add_subplot(1, 1, 1, projection="3d")
ax3d.scatter(...)  # Must use the method.
ax3d.set_zlabel(...)  # 3D Object has zlabel methods.

That second plot could do with being a little more visible too but they might be a result of the 2D plot, if not check the docs for ways to change marker size, shape, colour etc. - https://matplotlib.org/3.3.0/api/_as_gen/mpl_toolkits.mplot3d.axes3d.Axes3D.html#mpl_toolkits.mplot3d.axes3d.Axes3D.scatter

Thanks for this! I was able to update the 3D plot, but not until I added the import information from the first kernel. So it ended up looking like this:

%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]
ax3d = plt.figure()
ax3d = ax3d.add_subplot(1,1,1,projection="3d")
plt.title('Orion in 3d')
plt.xlabel('X Axis of Stars')
plt.ylabel('Y Axis of Stars')
ax3d.set_zlabel('Z Axis of Stars')

is there something I need to do for that kernel’s information to be usable across the document instead of having to copy/paste it each time?

Good stuff, happy to hear it was sorted. If you like working with Jupyter notebooks and you’re frequently starting your files with those imports there’s probably a way to get them to import automatically when you start a session. I’m afraid it’s been a while since I used them so I can’t remember any details off-hand but I believe that it’s fairly straightforward. Alternatively you could probably set-up your new files to open with those lines ready to execute or delete as necessary. Might be worth looking into at least.

1 Like

Thanks! Your comment about Jupyter reminds me of something I’ve been curious about - so far it’s been the only tool outside of codeacademy where I’ve edited. where are you normally writing your python? When I search for where python is used I either get use cases or something like Sublime text that doesn’t appear to connect to any data.

If i’m looking to practice on my own, would I need to execute it in the command prompt and somehow hook it to something like Kaggle? Or is there some other tool I need to get?

As for writing there’s numerous options for writing from basic text editors like vim (sans plug-ins) to full fledged IDEs. Worth trying a few out to see what you like. I think there’s a forum thread or two around with a few folks preferences or a quick online search would offer you innumerable opinions on the same. Pick a couple of highly rated options and try a few out on the next big project if you have the time to invest. I think getting started in a proper IDE isn’t such a bad shout as with minimal configuration you’d have in-built code-completions, an interactive interpreter to test code snippets, access to a terminal and proper debugging tools to name but a few options. Alternatively you could focus on your writing and do it in a basic text editor. Defo worth looking into a few online suggestions anyway.

It depends on what you’re looking to do. You’ve probably already got most of the tools installed for writing so if you wrote a basic python file in plaintext and wanted to run it you could do in command line with python myscript. Any additional modules you might need are often accessible through pip. If you wanted specific datasets and tasks to complete then you may have to look elsewhere for them.