From b0b6aa4078f9e59d8caddabd27096751be27a2c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gi=C3=B9=20Marcer?= Date: Fri, 5 Jun 2020 23:43:54 +0200 Subject: [PATCH] slides: create the .py to plot the Moyal --- slides/misc/moyal-plot.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100755 slides/misc/moyal-plot.py diff --git a/slides/misc/moyal-plot.py b/slides/misc/moyal-plot.py new file mode 100755 index 0000000..a4da48f --- /dev/null +++ b/slides/misc/moyal-plot.py @@ -0,0 +1,22 @@ +from matplotlib import pyplot as plt +import numpy as np + + +def moyal(x, μ, σ): + N = (1)/(np.sqrt(2 * np.pi) * σ) + return N * np.exp(- 0.5 * ((x - μ)/σ + np.exp(- (x - μ)/σ))) + + +# prepare plot +# plt.figure() +plt.figure(figsize=(3, 2)) +plt.rcParams['font.size'] = 8 + +# do plot +x = np.arange(-10, 30, 0.01) +plt.plot(x, moyal(x, 0, 1), color='#92182b') + +# save fig +plt.tight_layout() +# plt.show() +plt.savefig('slides/images/moyal-pdf.pdf', transparent=True)