Skip to content

Commit 7ba8f48

Browse files
committed
add notes section to meshgrid function
1 parent 2b63003 commit 7ba8f48

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

Diff for: spec/API_specification/creation_functions.md

+18-2
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ Returns evenly spaced numbers over a specified interval.
290290
- a one-dimensional array containing evenly spaced values.
291291
292292
(function-meshgrid)=
293-
### meshgrid(*arrays, /, *, indexing='xy')
293+
### meshgrid(*arrays, /, indexing='xy')
294294
295295
Returns coordinate matrices from coordinate vectors.
296296
@@ -302,7 +302,7 @@ Returns coordinate matrices from coordinate vectors.
302302
303303
### Parameters
304304
305-
- ***arrays**: _<array>_
305+
- **\*arrays**: _<array>_
306306
307307
- One dimensional arrays representing the coordinates of the grid.
308308
@@ -316,6 +316,22 @@ Returns coordinate matrices from coordinate vectors.
316316
317317
- List of N arrays with rank `max(2, N)`.
318318
319+
### Notes
320+
321+
This function supports indexing conventions using the `indexing` keyword. In the case of `xy` the function will return a meshgrid with cartesian indexing, while `ij` will use matrix indexing. The difference is illustrated by the following code snippet:
322+
323+
```
324+
xv, yv = meshgrid(x, y, indexing='xy')
325+
for i in range(nx):
326+
for j in range(ny):
327+
# treat xv[j, i], yv[j, i]
328+
329+
xv, yv = meshgrid(x, y, indexing='ij')
330+
for i in range(nx):
331+
for j in range(ny):
332+
# treat xv[i, j], yv[i, j]
333+
```
334+
319335
(function-ones)=
320336
### ones(shape, /, *, dtype=None, device=None)
321337

0 commit comments

Comments
 (0)