meshgrid¶
- meshgrid(*arrays: array, indexing: Literal['xy', 'ij'] = 'xy') List[array]¶
Returns coordinate matrices from coordinate vectors.
- Parameters:
arrays (array) – an arbitrary number of one-dimensional arrays representing grid coordinates. Each array should have the same numeric data type.
indexing (Literal["xy", "ij"]) – Cartesian
'xy'or matrix'ij'indexing of output. If provided zero or one one-dimensional vector(s) (i.e., the zero- and one-dimensional cases, respectively), theindexingkeyword has no effect and should be ignored. Default:'xy'.
- Returns:
out (List[array]) – list of N arrays, where
Nis the number of provided one-dimensional input arrays. Each returned array must have rankN. ForNone-dimensional arrays having lengthsNi = len(xi),if matrix indexing
ij, then each returned array must have the shape(N1, N2, N3, ..., Nn).if Cartesian indexing
xy, then each returned array must have shape(N2, N1, N3, ..., Nn).
Accordingly, for the two-dimensional case with input one-dimensional arrays of length
MandN, if matrix indexingij, then each returned array must have shape(M, N), and, if Cartesian indexingxy, then each returned array must have shape(N, M).Similarly, for the three-dimensional case with input one-dimensional arrays of length
M,N, andP, if matrix indexingij, then each returned array must have shape(M, N, P), and, if Cartesian indexingxy, then each returned array must have shape(N, M, P).Each returned array should have the same data type as the input arrays.
Notes
Changed in version 2022.12: Added complex data type support.