numpy - Python plot values at nodes in meshgrid -
i have from
numpy.meshgrid(xx,yy) a rectangular grid.
to coordinates (nodes) split 2 lists x , y 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 grid 36 points. (think of unit square)
now have solving linear scheme of equation list have size (36,1).
i want plot values (36,1) list @ corresponding nodes in grid.
so first 6 points (36,1) list lies on x-axis (y = 0) , next 6 lies on y = 0.2 , on. have thought how this?
take output array and:
disparray = myarray + (arange(6) * .2)[:,none] plot(x.flatten(), disparray.flatten(), '.') this should do.
and, of course of study can plot loop.
figure() r in range(myarray.shape[0]): plot(x[0], myarray[r] + 0.2*r, 'k') this uses x values first row of mesh x values in plot , plots each row of result array myarray @ offsets 0, 0.2, 0.4... black line
python numpy matplotlib plot mesh
No comments:
Post a Comment