I have an array A of shape (N,2) containing coordinate positions (in my case they are nodes coordinates positions x,y) and another array B of shape (N,1) containing the corresponding field values at the nodes in array A (in my case they are velocities). I would like to convert array B to a matrix in order to have an imshow() representation of the field at the nodes.
I have tried an alternative method (below) to plot my field using an interpolation on a meshgrid but the result isn't what am expecting but it the codes take too much time to compute the interpolations.
I think it would be easier to use imshow() method but i can't convert the field vector to a matrice
def plotField(field,coord):
xcoord = coord[:,0] #x coordinate
zcoord = coord[:,1] #z coordinate
x,z=np.meshgrid(xcoord,zcoord)
y = gd((xcoord,zcoord),field,(x,z),method='nearest') #field interpolation
plt.pcolormesh(x,z,field)
plt.show()
NB : In matlab one can do this with the patch command but i don't know it's equivalent in python. I found this question while searching which i think advanced python users should take a look to provide an answer ploting filled polygons in python