Skip to content
Justice Tech School

meshgrid

meshgrid builds coordinate grids from two vectors.

Example
x = np.array([0, 1, 2]); y = np.array([0, 10])
X, Y = np.meshgrid(x, y)
print(X)
print(Y)
print(X + Y)

Result

[[0 1 2]
 [0 1 2]]
[[ 0  0  0]
 [10 10 10]]
[[ 0  1  2]
 [10 11 12]]

Exercise

Coordinate grids.

np.(x, y)

Quiz Test

What is meshgrid for?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.