numpy.meshgrid() in Python

The meshgrid() function of Python numpy class returns the coordinate matrices from coordinate vectors.

Syntax

Parameter

The numpy.meshgrid() function consists of four parameters which are as follow:

x1, x2,…, xn: This parameter signifies 1-D arrays representing the coordinates of a grid.

indexing : {‘xy’, ‘ij’}, optional It is an optional parameter representing the cartesian (‘xy’, default) or matrix indexing of output.

sparse:  It is an optional parameter which takes Boolean value. If ‘True’ is passed then a sparse grid is returned in order to conserve memory.

copy: It is an optional parameter which takes Boolean value. If ‘False’ is passed, a view into the original arrays are returned to conserve the memory.

Return

This function returns the coordinate length from coordinate vectors.

Example 1

Output

Example 2

Output

Pin It on Pinterest

Share This