Create README.md
Signed-off-by: David Rotermund <54365609+davrot@users.noreply.github.com>
This commit is contained in:
parent
af28ebcc71
commit
c1c1a2e371
1 changed files with 40 additions and 0 deletions
40
matplotlib/animation_and_slider/README.md
Normal file
40
matplotlib/animation_and_slider/README.md
Normal file
|
@ -0,0 +1,40 @@
|
|||
# Animation and Slider
|
||||
{:.no_toc}
|
||||
|
||||
<nav markdown="1" class="toc-class">
|
||||
* TOC
|
||||
{:toc}
|
||||
</nav>
|
||||
|
||||
## The goal
|
||||
|
||||
|
||||
Questions to [David Rotermund](mailto:davrot@uni-bremen.de)
|
||||
|
||||
|
||||
## Test data
|
||||
|
||||
```python
|
||||
import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
axis = np.arange(-100, 101) / 100.0
|
||||
|
||||
x = axis[:, np.newaxis, np.newaxis].copy()
|
||||
y = axis[np.newaxis, :, np.newaxis].copy()
|
||||
z = axis[np.newaxis, np.newaxis, :].copy()
|
||||
|
||||
r = np.sqrt(x**2 + y**2 + z**2)
|
||||
|
||||
mask_0 = r > 0.75
|
||||
r = 1.0 / (r + 1.0)
|
||||
r[mask_0] = 0
|
||||
|
||||
plt.imshow(r[100, :, :], cmap="hot")
|
||||
plt.colorbar()
|
||||
plt.title("Cut through center of x-axis")
|
||||
plt.show()
|
||||
```
|
||||
|
||||
![image0](image0.png)
|
||||
|
Loading…
Reference in a new issue