Orion visualization - github

Orion - github

Hi, just finished Orion project, first try with github upload as well.

Furthermore: anyone know why I can’t change the size of the stars with the same parameter as in the 2d figure?

constellation3d = plt.scatter(x,y,z, color=‘orange’, marker="*", linewidths=1, edgecolor=‘blue’)

Using a parameter s=x in plt.scatter, gives the error:
TypeError: scatter() got multiple values for argument ‘s’

You’re not using the 3d object for the scatterplot–your code needs a bit of tweaking.

Maybe try this?:

fig3d = plt.figure()
ax3D = fig3d.add_subplot(1,1,1, projection="3d")
ax3D.set_facecolor('black')
ax3D.grid(False)
ax3D.w_xaxis.set_pane_color((0, 0, 0, 0))
ax3D.w_yaxis.set_pane_color((0, 0, 0, 0))
ax3D.w_zaxis.set_pane_color((0, 0, 0, 0))
ax3D.scatter(x,y,z, c='orange', marker="*", s= 90, linewidths=1, edgecolor='blue')
plt.title('Learning visualizations in Python: reaching for the stars')
plt.show()
1 Like

Thx for you help.
Is the difference between your version and my version as follows:

You are using class methods / object oriented to change the color of the stars/background.

I am using the plt.method, which limits me to further change the color of the stars in 3d.
plt.scatter(x,y,z, color=‘orange’, marker="*", linewidths=1, edgecolor=‘blue’) does have a ‘parameter’ to change the size
of the 3d stars.

Sorry for any confusion. You need to use the scatter method of the 3d axis itself (so there’s a z axis).
This line here needs to be corrected:
fig_3d.add_subplot(111, projection='3d')

to:
ax3D = fig3d.add_subplot(1,1,1, projection="3d")

so you can then do this:
ax3D.scatter(x,y,z, c='orange', marker="*", s= 90, linewidths=1, edgecolor='blue')

See the docs:
https://matplotlib.org/stable/api/_as_gen/mpl_toolkits.mplot3d.axes3d.Axes3D.html

2 Likes

Thanks, I see what I missed in my first attempt :slight_smile: The documentation links helps a bunch!

1 Like