diff --git a/module2/exo2/exercice_python_fr.org b/module2/exo2/exercice_python_fr.org index a3da8f0b8c24d20f082bebdcbcdc7497f31f81a0..5c21271d6894341fcc045c9d095d2e29fef217f7 100644 --- a/module2/exo2/exercice_python_fr.org +++ b/module2/exo2/exercice_python_fr.org @@ -4,6 +4,8 @@ #+LANGUAGE: fr # #+PROPERTY: header-args :eval never-export +#+PROPERTY: mkdirp yes + #+HTML_HEAD: #+HTML_HEAD: #+HTML_HEAD: @@ -11,7 +13,7 @@ #+HTML_HEAD: #+HTML_HEAD: -Import des données +* Import des données #+begin_src python :results output :session :exports both import numpy as np @@ -28,6 +30,7 @@ print(dataSource) : 19.6 21.7 11.3 15. 14.3 16.8 14. 6.8 8.2 19.9 20.4 14.6 16.4 18.7 : 16.8 15.8 20.4 15.8 22.4 16.2 20.3 23.4 12.1 15.5 15.4 18.4 15.7 10.2 : 8.9 21. ] +* Partie 1&2 La moyenne : #+begin_src python :results output :session :exports both @@ -69,3 +72,49 @@ print(np.std(dataSource, ddof=1)) #+RESULTS: : 4.334094455301447 +* Partie 3 + +#+begin_src python :session :results file :var matplot_lib_filename="images/sequence.png" :exports both +import matplotlib.pyplot as plt +import numpy as np + +w = np.arange(0, len(dataSource)) +fig1 = plt.figure(figsize=(5,5)) +plt.plot(list(w), list(dataSource), 'b-') + + +# Parameters +plt.grid(True) +plt.tight_layout() +plt.xlim(0,100) +plt.ylim(0,25) + +plt.savefig(matplot_lib_filename) +matplot_lib_filename + +#+end_src + +#+RESULTS: +[[file:images/sequence.png]] +#+begin_src python :session :results file :var matplot_lib_filename="images/hist.png" :exports both +import matplotlib.pyplot as plt +import numpy as np + +# Actual plot +fig1 = plt.figure() +plt.hist(list(dataSource), edgecolor='k') + +# Parameters +plt.grid(True) +plt.tight_layout() +plt.xlim(0,25) +plt.ylim(0,25) + +# Export the picture +plt.savefig(matplot_lib_filename) +matplot_lib_filename + +#+end_src + +#+RESULTS: +[[file:images/hist.png]] diff --git a/module2/exo2/images/hist.png b/module2/exo2/images/hist.png new file mode 100644 index 0000000000000000000000000000000000000000..fbf0ac47abf58cebd33819848c2a08777a4a878a Binary files /dev/null and b/module2/exo2/images/hist.png differ diff --git a/module2/exo2/images/sequence.png b/module2/exo2/images/sequence.png new file mode 100644 index 0000000000000000000000000000000000000000..daf7d974e00bd2e1952775fd4f342e45a71e9335 Binary files /dev/null and b/module2/exo2/images/sequence.png differ