1

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
1
  • 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. Commented Jun 3, 2016 at 16:53

1 Answer 1

3

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()

Read more at the tutorial

answered Jun 3, 2016 at 16:58
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.