Generate two matrices for use in three-dimensional plots.
Arguments
- x
numerical vector, represents points along the x-axis.
- y
numerical vector, represents points along the y-axis.
Details
The rows of the output array X are copies of the vector x;
columns of the output array Y are copies of the vector y.
Value
Returns two matrices as a list with X and Y components.
Note
The three-dimensional variant meshgrid(x, y, z) is not yet implemented.
Examples
meshgrid(1:5)$X
#> [,1] [,2] [,3] [,4] [,5]
#> [1,] 1 2 3 4 5
#> [2,] 1 2 3 4 5
#> [3,] 1 2 3 4 5
#> [4,] 1 2 3 4 5
#> [5,] 1 2 3 4 5
meshgrid(c(1, 2, 3), c(11, 12))
#> $X
#> [,1] [,2] [,3]
#> [1,] 1 2 3
#> [2,] 1 2 3
#>
#> $Y
#> [,1] [,2] [,3]
#> [1,] 11 11 11
#> [2,] 12 12 12
#>