Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 11781

plot a slice of 3D data with pcolormesh

$
0
0

I have data in 2 numpy arrays: one a list of 3D positions, the other the values of a scalar AT each of those positions. The ordering of the position data is fairly 'weird' (see below).

The 3D position data is in an array:

pos = np.array([[1,1,1],[1,1,2],[1,1,3],[1,2,2],[1,2,1], ...])

pos.shape is (100000,3)where the ordering is not intuitive (it is following a space filling curve).

and I also have the scalar values that I want to plot at each of those locations:

vel = np.array([1,2,1,3,4,...])

vel.shape = (1000000,1)

My question is, how do I plot an xy slice with pcolormesh from this data??? I can extract an xy plane with numpy:

xs = pos[:,:1][:,0]ys = pos[:,1:2][:,0]

now I have a bunch of essentially random x coords and y coords that no long map 1-1 to the vel data... :/ I don't know how to first map those initial positions to my vel data so that I can generate a pcolormesh:

plt.pcolormesh(X, Y, V)

Can someone help me slice this data up so everything stays mapped to the right position in xy (and z) space?


Viewing all articles
Browse latest Browse all 11781

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>