I've not yet worked with a 3 dimensional array and I'm a little confused on how to approach this plotting with its relative large size.
There is relative code to this, but it's not necessarily needed in this case.
import matplotlib.pyplot as plt
import numpy as np
from mpl_toolkits.mplot3d import Axes3D
mask1 = (8e+11 < Mvir1) & (Mvir1 < 2.4e+12)
MWmasses1 = Mvir1[mask1]
MWpos1 = Pos1[mask1]
MWpos1 will have a shape of (1220, 3)
and it looks like this,
[[ 51618.7265625 106197.7578125 69647.6484375 ]
[ 33864.1953125 11757.29882812 11849.90332031]
[ 12750.09863281 58954.91015625 38067.0859375 ]
...,
[ 99002.6640625 96021.0546875 18798.44726562]
[ 27180.83984375 74350.421875 78075.78125 ]
[ 19297.88476562 82161.140625 1204.53503418]]
If there is any additional information left out that is needed, I will be more than happy to post it.
I appreciate any help that is given.
asked Jun 3, 2016 at 16:30
iron2man
1,8575 gold badges29 silver badges42 bronze badges
-
So you have a collection of 1220 points that you want to plot in 3D? If you have problems plotting that with mplot3d, I would suggest mayavi. It'll easily handle that amount.Jsl– Jsl2016年06月03日 16:53:41 +00:00Commented Jun 3, 2016 at 16:53
1 Answer 1
Unpack the values and plot
x,y,z = zip(*MWpos1)
fig = plt.figure()
ax = fig.gca(projection='3d')
ax.plot(x, y, z, '.')
ax.legend()
plt.show()
answered Jun 3, 2016 at 16:58
michael_j_ward
4,6991 gold badge27 silver badges25 bronze badges
Sign up to request clarification or add additional context in comments.
Comments
lang-py