{ } Raw JSON

bundles / numpy 2.4.4 / numpy / lib / _index_tricks_impl / MGridClass

class

numpy.lib._index_tricks_impl:MGridClass

source: /numpy/lib/_index_tricks_impl.py :211

Signature

class   MGridClass ( )

Members

Summary

An instance which returns a dense multi-dimensional "meshgrid".

Extended Summary

An instance which returns a dense (or fleshed out) mesh-grid when indexed, so that each returned argument has the same shape. The dimensions and number of the output arrays are equal to the number of indexing dimensions. If the step length is not a complex number, then the stop is not inclusive.

However, if the step length is a complex number (e.g. 5j), then the integer part of its magnitude is interpreted as specifying the number of points to create between the start and stop values, where the stop value is inclusive.

Returns

mesh-grid : ndarray

A single array, containing a set of ndarrays all of the same dimensions. stacked along the first axis.

Examples

import numpy as np
np.mgrid[0:5, 0:5]
np.mgrid[-1:1:5j]
np.mgrid[0:4].shape
np.mgrid[0:4, 0:5].shape
np.mgrid[0:4, 0:5, 0:6].shape

See also

how-to-partition

ref

meshgrid

return coordinate matrices from coordinate vectors

ogrid

like mgrid but returns open (not fleshed out) mesh grids

r_

array concatenator

Aliases

  • numpy.lib._index_tricks_impl.MGridClass