create a mesh grid from major and minor values.
given two arrays major_values and minor_values, this function generates a pair of 2D arrays representing the major-grid and minor-grid. the major-grid contains rows of major_values, and the minor-grid contains columns of minor_values.
major_values
minor_values
import { assertEquals } from "jsr:@std/assert"const y_values = [1, 2, 3], x_values = [4, 5], [yy_grid, xx_grid] = meshGrid(y_values, x_values)assertEquals(yy_grid, [ [1, 1], [2, 2], [3, 3],])assertEquals(xx_grid, [ [4, 5], [4, 5], [4, 5],]) Copy
import { assertEquals } from "jsr:@std/assert"const y_values = [1, 2, 3], x_values = [4, 5], [yy_grid, xx_grid] = meshGrid(y_values, x_values)assertEquals(yy_grid, [ [1, 1], [2, 2], [3, 3],])assertEquals(xx_grid, [ [4, 5], [4, 5], [4, 5],])
the values to be used as rows in the major-grid
the values to be used as columns in the minor-grid
a 2-tuple containing the major-grid and minor-grid as 2D arrays
create a mesh grid from major and minor values.
given two arrays
major_values
andminor_values
, this function generates a pair of 2D arrays representing the major-grid and minor-grid. the major-grid contains rows ofmajor_values
, and the minor-grid contains columns ofminor_values
.Example