From c1c1a2e37190e322f5ce30ea1215fcb71504d992 Mon Sep 17 00:00:00 2001 From: David Rotermund <54365609+davrot@users.noreply.github.com> Date: Thu, 21 Dec 2023 15:24:47 +0100 Subject: [PATCH] Create README.md Signed-off-by: David Rotermund <54365609+davrot@users.noreply.github.com> --- matplotlib/animation_and_slider/README.md | 40 +++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 matplotlib/animation_and_slider/README.md diff --git a/matplotlib/animation_and_slider/README.md b/matplotlib/animation_and_slider/README.md new file mode 100644 index 0000000..bbd15ed --- /dev/null +++ b/matplotlib/animation_and_slider/README.md @@ -0,0 +1,40 @@ +# Animation and Slider +{:.no_toc} + + + +## 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) +