From af6fdac1c1b16c0a1ccc13b683e0b444c8ab06ae Mon Sep 17 00:00:00 2001 From: David Rotermund <54365609+davrot@users.noreply.github.com> Date: Tue, 19 Dec 2023 12:00:18 +0100 Subject: [PATCH] Create README.md Signed-off-by: David Rotermund <54365609+davrot@users.noreply.github.com> --- numpy/mesh_grid/README.md | 49 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 numpy/mesh_grid/README.md diff --git a/numpy/mesh_grid/README.md b/numpy/mesh_grid/README.md new file mode 100644 index 0000000..6024a8d --- /dev/null +++ b/numpy/mesh_grid/README.md @@ -0,0 +1,49 @@ +# Meshgrid +{:.no_toc} + + + +## The goal + + +Questions to [David Rotermund](mailto:davrot@uni-bremen.de) + +## [numpy.meshgrid](https://numpy.org/doc/stable/reference/generated/numpy.meshgrid.html) + + +```python +numpy.meshgrid(*xi, copy=True, sparse=False, indexing='xy') +``` + +> Return a list of coordinate matrices from coordinate vectors. +> +> Make N-D coordinate arrays for vectorized evaluations of N-D scalar/vector fields over N-D grids, given one-dimensional coordinate arrays x1, x2,…, xn. + +```python +import numpy as np +import matplotlib.pyplot as plt + +x = np.linspace(0, 1, 100) +y = np.linspace(0, 1, 100) + +xv, yv = np.meshgrid(x, y) + +plt.imshow(xv, cmap="hot") +plt.xlabel("x axis") +plt.ylabel("y axis") +plt.title("xv") +plt.show() + +plt.imshow(yv, cmap="hot") +plt.xlabel("x axis") +plt.ylabel("y axis") +plt.title("yv") +plt.show() +``` + +![image0](image0.png) + +![image1](image1.png)