Reputation: 3
I have from
numpy.meshgrid(xx,yy)
a rectangular grid.
To get the coordinates (nodes) I split it into two lists X and Y with values:
X = (0.0 , 0.2 , 0.4 , 0.6 , 0.8 , 1.0)*6
Y = (0.0 , 0.2 , 0.4 , 0.6 , 0.8 , 1.0)*6
Which gives a grid with 36 points. (think of it as a unit square)
Now i have from solving a linear system of equation another list which have the size (36,1).
I want to plot the values from the (36,1) list at the corresponding nodes in my grid.
So the first 6 points from the (36,1) list lies on the x-axis (Y = 0) and then the following 6 lies on Y = 0.2 and so on. Does anyone have any idea how to do this?
Upvotes: 0
Views: 1059
Reputation: 23550
Take your output array and:
disparray = myarray + (arange(6) * .2)[:,None]
plot(X.flatten(), disparray.flatten(), '.')
This should do.
And, of course you can plot with a for loop.
figure()
for r in range(myarray.shape[0]):
plot(X[0], myarray[r] + 0.2*r, 'k')
This uses the X values from the first row of your mesh as the X values in the plot and plots each row of your result array myarray
at offsets 0, 0.2, 0.4... with a black line
Upvotes: 1