I'm not quite sure how to say this so I'll try to be clear in my description. Right now I have a 3D numpy array where the 1st column represents a depth and the 2nd a position on the x-axis. My goal is to make a pcolor where the columns are spread out along the x-axis based on the values in a 1D float array.
Here's where it gets tricky, I only have the relative distances between points. That is, the distance between column 1 and column 2 and so on.
Here's an example of what I have and what I'd like:
darray = [[2 3 7 7]
[4 8 2 3]
[6 1 9 5]
[3 4 8 4]]
posarray = [ 3.767, 1.85, 0.762]
DesiredArray = [[2 0 0 0 3 0 7 7]
[4 0 0 0 8 0 2 3]
[6 0 0 0 1 0 9 5]
[3 0 0 0 4 0 8 4]]
How I tried implementing it:
def space_set(darr, sarr):
spaced = np.zeros((260,1+int(sum(sarr))), dtype = float)
x = 0
for point in range(len(sarr)):
spaced[:, x] = darr[:,point]
x = int(sum(sarr[0:point]))
spaced[:,-1] = darr[:,-1]
Then I was planning on using matplotlibs pcolor to plot it. This method seems to lose columns though. Any ideas for either directly plotting or making a numpy array to plot? Thanks in advance.
Here's an example of what I'm looking for.