Orion Costellation Project

Here is my project it was quite fun, but there is something left to label the Z axis, for this project.

Hi Ivan :wave:, thanks for sharing. Looks great, but you said:

Do you have what you need to do this? Or do you need help?

Thank you :), Yes, actually in the 3D visualization it will really helpful to include i saw matplotlib documents and is quite straightforward but the code changes a lot, so i would like to know with this code how to add the “Z” axis label.

Hi this is the code of the project, i am wondering if there is a way increase the size of the dots, and if there is a way to label Z axis.
i think they are a bit small.

%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]
fig=plt.figure()
fig.add_subplot(1,1,1)
plt.scatter(x,y)
plt.show()

fig_3D=plt.figure()
fig_3D.add_subplot(1,1,1,projection=‘3d’)
constellation3d=plt.scatter(x,y,z)
plt.title(‘3d constellation’)
plt.xlabel(‘x values’)
plt.ylabel(‘y values’)
plt.show()

Hi @ivansing,

Please see this response for the details on why you are unable to label the z-axis and what you need to do to achieve this-


After that you can just use ax.set_zlabel('mylabel') to set the z-label.

@mak84271 the link will also help you as third argument you intended to use as the z values for the star locations is instead being interpreted as an argument to s which equates to marker size. You should use the 3d axis object instead which will proabably lead to slightly larger markers (the default is 20) which is why your z values make the plot so small.
If they’re still not a decent size use a named argument (s) after x, y, z in your 3D scatter-

ax3d.scatter(x, y, z, s=40)  # Or whatever size you like (it's a quadratic size increase)
ax3d.scatter(x, y, z, 30)  # works on the 3D scatter
1 Like

Ty for the reply, i just changed the code , there’s why the dots were so small.
thanks
Sorry for the grammar but i’m italian so idk if i wrote correctly.

1 Like