mirror of
https://github.com/davrot/pytutorial.git
synced 2025-04-18 05:06:41 +02:00
Create README.md
Signed-off-by: David Rotermund <54365609+davrot@users.noreply.github.com>
This commit is contained in:
parent
8f9b0e98ac
commit
af6fdac1c1
1 changed files with 49 additions and 0 deletions
49
numpy/mesh_grid/README.md
Normal file
49
numpy/mesh_grid/README.md
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
# Meshgrid
|
||||||
|
{:.no_toc}
|
||||||
|
|
||||||
|
<nav markdown="1" class="toc-class">
|
||||||
|
* TOC
|
||||||
|
{:toc}
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
## 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()
|
||||||
|
```
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|

|
Loading…
Add table
Reference in a new issue