Numpy.meshgrid Š NumPy V1.15 Manual — Num Py
numpy.meshgrid%20%E2%80%94%20NumPy%20v1.15%20Manual
User Manual:
Open the PDF directly: View PDF
.
Page Count: 3

numpy.meshgrid
sparse=False, copy=False
Previous topic
Next topic
Quick search
numpy.meshgrid — NumPy v1.15 Manual https://docs.scipy.org/doc/numpy-1.15.0/reference/generated/numpy.mes...
1 von 3
31.01.2019, 21:07

Ni=len(xi)
(N1, N2, N3,...Nn)
(N2, N1, N3,...Nn)
xv, yv = np.meshgrid(x, y, sparse=False, indexing='ij'
)
for iin range(nx):
for jin range(ny):
# treat xv[i,j], yv[i,j]
xv, yv = np.meshgrid(x, y, sparse=False, indexing='xy'
)
for iin range(nx):
for jin range(ny):
# treat xv[j,i], yv[j,i]
>>>
numpy.meshgrid — NumPy v1.15 Manual https://docs.scipy.org/doc/numpy-1.15.0/reference/generated/numpy.mes...
2 von 3
31.01.2019, 21:07

>>> nx, ny = (3, 2)
>>> x = np.linspace(0, 1, nx)
>>> y = np.linspace(0, 1, ny)
>>> xv, yv = np.meshgrid(x, y)
>>> xv
array([[ 0. , 0.5, 1. ],
[ 0. , 0.5, 1. ]])
>>> yv
array([[ 0., 0., 0.],
[ 1., 1., 1.]])
>>> xv, yv = np.meshgrid(x, y, sparse=True)# make sp
arse output arrays
>>> xv
array([[ 0. , 0.5, 1. ]])
>>> yv
array([[ 0.],
[ 1.]])
>>> x = np.arange(-5, 5, 0.1)
>>> y = np.arange(-5, 5, 0.1)
>>> xx, yy = np.meshgrid(x, y, sparse=True)
>>> z = np.sin(xx**2 + yy**2) / (xx**2 + yy**2)
>>> h = plt.contourf(x,y,z)
>>>
numpy.meshgrid — NumPy v1.15 Manual https://docs.scipy.org/doc/numpy-1.15.0/reference/generated/numpy.mes...
3 von 3
31.01.2019, 21:07