teaching:progappchim:matplotlib_simple

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentes Révision précédente
Prochaine révision
Révision précédente
teaching:progappchim:matplotlib_simple [2021/01/11 12:30] – [Références] villersdteaching:progappchim:matplotlib_simple [2023/07/11 07:46] (Version actuelle) – [Références] villersd
Ligne 1: Ligne 1:
 ====== Les bases de Matplotlib, une librairie pour réaliser des graphiques 2D ====== ====== Les bases de Matplotlib, une librairie pour réaliser des graphiques 2D ======
  
-[[http://matplotlib.org/|Matplotlib]] est une bibliothèque très puissante du langage de programmation Python destinée à tracer et visualiser des données sous formes de graphiques. Elle est souvent combinée avec les bibliothèques python de calcul scientifique :+[[https://matplotlib.org/stable/index.html/|Matplotlib]] est une bibliothèque très puissante du langage de programmation Python destinée à tracer et visualiser des données sous formes de graphiques. Elle est souvent combinée avec les bibliothèques python de calcul scientifique :
   * [[http://www.numpy.org/|NumPy]] : gestion de tableaux numériques multidimensionnels, algèbre linéaire, transformées de Fourier, nombres (pseudo-)aléatoires   * [[http://www.numpy.org/|NumPy]] : gestion de tableaux numériques multidimensionnels, algèbre linéaire, transformées de Fourier, nombres (pseudo-)aléatoires
   * [[http://scipy.org/scipylib/index.html|SciPy]] : méthodes numériques comme l'intégration ou l'optimisation   * [[http://scipy.org/scipylib/index.html|SciPy]] : méthodes numériques comme l'intégration ou l'optimisation
Ligne 9: Ligne 9:
 Avec Matplotlib, on peut créer rapidement un graphe à partir de deux listes (voir le premier exemple ci-après). Avec Matplotlib, on peut créer rapidement un graphe à partir de deux listes (voir le premier exemple ci-après).
  
-Matplotlib permet de générer facilement des graphiques, camemberts ou autres histogrammes, intégrant symboles, barres d'erreur, éléments colorés,... Il peut créer pratiquement tous les types connus de graphiques (consulter la [[http://matplotlib.org/gallery.html|galerie d'exemples]]).+Matplotlib permet de générer facilement des graphiques, camemberts ou autres histogrammes, intégrant symboles, barres d'erreur, éléments colorés,... Il peut créer pratiquement tous les types connus de graphiques (consulter la [[https://matplotlib.org/stable/gallery/index.html|galerie d'exemples]]).
  
 Le projet [[http://wiki.scipy.org/PyLab|Pylab]] vise à regrouper ces différentes librairies. De nombreuses commandes de Pylab ont été définies semblablement aux commandes du logiciel commercial [[http://fr.wikipedia.org/wiki/MATLAB|MatLab]]. Le projet [[http://wiki.scipy.org/PyLab|Pylab]] vise à regrouper ces différentes librairies. De nombreuses commandes de Pylab ont été définies semblablement aux commandes du logiciel commercial [[http://fr.wikipedia.org/wiki/MATLAB|MatLab]].
  
-TODO : différences pyplot comme ici : https://towardsdatascience.com/5-quick-facts-about-python-matplotlib-53f23eab6d31+TODO : différences pyplot comme ici : [[https://towardsdatascience.com/5-quick-facts-about-python-matplotlib-53f23eab6d31]]
  
 ===== Installation ===== ===== Installation =====
Ligne 170: Ligne 170:
 %matplotlib inline %matplotlib inline
 </code> </code>
 +
 +===== Régression linéaire =====
 +  * exemple simple : [[https://openwritings.net/pg/python/python-use-scipystatslinregress-get-linear-least-squares-regression-equation|Python - Use scipy.stats.linregress to get the linear least-squares regression equation]]
 +  * voir aussi [[pandas]]
  
 ===== Animations ===== ===== Animations =====
Ligne 198: Ligne 202:
   * [[https://github.com/thehackerwithin/PyTrieste/wiki/Python7-MatPlotLib|Un tutoriel en anglais]]   * [[https://github.com/thehackerwithin/PyTrieste/wiki/Python7-MatPlotLib|Un tutoriel en anglais]]
   * [[http://scipy-lectures.github.io/intro/matplotlib/matplotlib.html|Matplotlib: plotting]], par Nicolas Rougier, Mike Müller, Gaël Varoquaux (et la [[http://www.labri.fr/perso/nrougier/teaching/matplotlib/|version dérivée]] de Nicolas Rougier)   * [[http://scipy-lectures.github.io/intro/matplotlib/matplotlib.html|Matplotlib: plotting]], par Nicolas Rougier, Mike Müller, Gaël Varoquaux (et la [[http://www.labri.fr/perso/nrougier/teaching/matplotlib/|version dérivée]] de Nicolas Rougier)
 +  * [[https://github.com/rougier/scientific-visualization-book|Scientific Visualization: Python & Matplotlib]] (Nicolas P. Rougier)
   * [[https://realpython.com/python-matplotlib-guide/|Python Plotting With Matplotlib (Guide)]], 2018   * [[https://realpython.com/python-matplotlib-guide/|Python Plotting With Matplotlib (Guide)]], 2018
   * [[http://www.thetechrepo.com/main-articles/465-how-to-create-a-graph-in-python.html]]   * [[http://www.thetechrepo.com/main-articles/465-how-to-create-a-graph-in-python.html]]
Ligne 207: Ligne 212:
     * [[https://python-graph-gallery.com/|the Python Graph Gallery]], galerie de graphes Seaborn/Matplotlib avec code     * [[https://python-graph-gallery.com/|the Python Graph Gallery]], galerie de graphes Seaborn/Matplotlib avec code
     * [[https://medium.com/@neuralnets/statistical-data-visualization-series-with-python-and-seaborn-for-data-science-5a73b128851d|Data Visualization with Python and Seaborn]]     * [[https://medium.com/@neuralnets/statistical-data-visualization-series-with-python-and-seaborn-for-data-science-5a73b128851d|Data Visualization with Python and Seaborn]]
 +    * [[https://medium.com/codex/a-reference-notebook-for-30-statistical-charts-in-seaborn-9da14b156ef9|A Reference Notebook for (+30) Statistical Charts in Seaborn]] Anello, Medium, 02/04/2021
 +    * [[https://medium.com/geekculture/8-best-seaborn-visualizations-20143a4b3b2f|8 Best Seaborn Visualizations - How to plot statistical graphs using the Python Seaborn library?]] Tirendaz Academy, Medium, 07/05/2022
 +  * [[https://manimplotlib.readthedocs.io/en/latest/index.html|manimplotlib]], libraire de graphes animés
   * [[https://waterprogramming.wordpress.com/2016/04/29/interactive-plotting-basics-in-matplotlib/|Interactive plotting basics in matplotlib]]   * [[https://waterprogramming.wordpress.com/2016/04/29/interactive-plotting-basics-in-matplotlib/|Interactive plotting basics in matplotlib]]
   * [[https://heartbeat.fritz.ai/introduction-to-matplotlib-data-visualization-in-python-d9143287ae39|Introduction to Matplotlib — Data Visualization in Python]]   * [[https://heartbeat.fritz.ai/introduction-to-matplotlib-data-visualization-in-python-d9143287ae39|Introduction to Matplotlib — Data Visualization in Python]]
Ligne 227: Ligne 235:
     * [[https://towardsdatascience.com/making-publication-quality-figures-in-python-part-iii-box-plot-bar-plot-scatter-plot-407fa457449|Making publication-quality figures in Python (Part III): box plot, bar plot, scatter plot, histogram, heatmap, color map - Walking you through how to understand the mechanisms behind these widely-used figure types]] (Guangyuan (Frank) Li, Medium, Jan, 2021)     * [[https://towardsdatascience.com/making-publication-quality-figures-in-python-part-iii-box-plot-bar-plot-scatter-plot-407fa457449|Making publication-quality figures in Python (Part III): box plot, bar plot, scatter plot, histogram, heatmap, color map - Walking you through how to understand the mechanisms behind these widely-used figure types]] (Guangyuan (Frank) Li, Medium, Jan, 2021)
     * [[https://towardsdatascience.com/making-publication-quality-figures-in-python-part-iv-violin-plot-and-dendrogram-ed0bb8b23ddd|Making publication-quality figures in Python (Part IV): Violin plot and dendrogram - Drawing violin plot and dendrogram from the scratch, a step-by-step guide]] (Guangyuan (Frank) Li, Medium, Jan, 2021)     * [[https://towardsdatascience.com/making-publication-quality-figures-in-python-part-iv-violin-plot-and-dendrogram-ed0bb8b23ddd|Making publication-quality figures in Python (Part IV): Violin plot and dendrogram - Drawing violin plot and dendrogram from the scratch, a step-by-step guide]] (Guangyuan (Frank) Li, Medium, Jan, 2021)
 +    * [[https://medium.com/@mathcube7/violin-plots-in-matplotlib-fcba7232c8c1|Violin plots in matplotlib. Your dose of Scientific Python]] Mathcube, Medium, 07/04/2023
     * [[https://towardsdatascience.com/all-you-need-to-know-about-seaborn-6678a02f31ff|All you need to know about Seaborn - When should I use Seaborn versus matplotlib, and how to use it?]] (Guangyuan (Frank) Li, Medium, Jan, 2021)     * [[https://towardsdatascience.com/all-you-need-to-know-about-seaborn-6678a02f31ff|All you need to know about Seaborn - When should I use Seaborn versus matplotlib, and how to use it?]] (Guangyuan (Frank) Li, Medium, Jan, 2021)
     * [[https://github.com/frankligy/python_visualization_tutorial|GitHub - frankligy/python_visualization_tutorial: A comprehensive guide of how to make publication-ready figures in python]]     * [[https://github.com/frankligy/python_visualization_tutorial|GitHub - frankligy/python_visualization_tutorial: A comprehensive guide of how to make publication-ready figures in python]]
   * [[https://towardsdatascience.com/making-matplotlib-beautiful-by-default-d0d41e3534fd|Making Matplotlib Beautiful By Default - Use Seaborn to control Matplotlib defaults (and forget that shade of blue forever)]] Callum Ballard, Medium, 22/05/2020   * [[https://towardsdatascience.com/making-matplotlib-beautiful-by-default-d0d41e3534fd|Making Matplotlib Beautiful By Default - Use Seaborn to control Matplotlib defaults (and forget that shade of blue forever)]] Callum Ballard, Medium, 22/05/2020
   * [[https://towardsdatascience.com/creative-report-designed-only-with-matplotlib-without-office-software-9d8b5af4f9c2|Creative report designed only with Matplotlib, without office software]] Yefeng Xia, Medium, 04/01/2021   * [[https://towardsdatascience.com/creative-report-designed-only-with-matplotlib-without-office-software-9d8b5af4f9c2|Creative report designed only with Matplotlib, without office software]] Yefeng Xia, Medium, 04/01/2021
 +  * [[https://towardsdatascience.com/texts-fonts-and-annotations-with-pythons-matplotlib-dfbdea19fc57|Texts, Fonts, and Annotations with Python’s Matplotlib - When and how to use texts in your data visualizations]] Thiago Carvalho, Medium, 21/01/2021
 +  * [[https://medium.com/dataseries/mastering-matplotlib-part-1-a480109171e3|Mastering Matplotlib: Part 1. Understanding Matplotlib Architecture...]] by Lawrence Alaso Krukrubo - DataSeries - Medium, 17/06/2020
 +  * [[https://medium.com/dataseries/mastering-matplotlib-part-2-a5114433fa0|Mastering Matplotlib: Part 2. Exploring Matplotlib-Pandas]] by Lawrence Alaso Krukrubo - DataSeries - Medium, 29/06/2020
 +  * [[https://levelup.gitconnected.com/matplotlib-ultimate-cheat-sheet-2021-2bcd1646f41e|Matplotlib Ultimate Cheat Sheet (2021) The complete guide to Matplotlib in Python for your plotting needs]] Nathaniel J, 04/05/2021
 +  * [[https://towardsdatascience.com/4-things-to-know-to-have-a-better-understanding-of-matplotlib-a84ed54b3b2c|4 Things to Know to Have a Better Understanding of Matplotlib - Getting familiar with one of the original Python data visualization libraries]] Soner Yıldırım, 16/09/2022, Medium
 +    - Figure and Axes
 +    - Some things can be implicit
 +    - Labels on Figure and Axes
 +    - Figure with multiple Axes
 +  * [[https://medium.com/codex/how-to-create-scientific-plots-using-matplotlib-python-and-latex-23a471c8bb69|How to Create Scientific Plots Using Matplotlib, Python, and LaTeX]] Berkay Kullukçu, Medium, 16/08/2022
 +  * [[https://towardsdatascience.com/12-essential-visualizations-and-how-to-implement-them-part-2-e47c1d4b9784|2 Essential Visualizations and How to Implement Them, Part 2 - We look at how to create the 12 most useful graphs and charts in Python and Streamlit]] Alan Jones, Medium, 19/10/2022
 +  * [[https://ibexorigin.medium.com/yes-these-unbelievable-masterpieces-are-created-with-matplotlib-22780667dee|Yes, These Unbelievable Masterpieces Are Created With Matplotlib - Next to them, my plots are doodle sketches]] Bex T., Medium, 03/07/2023
  
  
 +===== Références générales sur les graphiques et visualisations ou représentations visuelles =====
 +  * Principes généraux, histoire,...
 +    * [[https://www.edwardtufte.com/tufte/books_vdqi|The Visual Display of Quantitative Information]] Edward Tufte
 +    * [[http://www.openculture.com/2019/07/napoleons-disastrous-invasion-of-russia-explained-in-an-1869-data-visualization.html|Napoleon’s Disastrous Invasion of Russia Detailed in an 1869 Data Visualization: It’s Been Called “the Best Statistical Graphic Ever Drawn”]]
  
 +  * Articles intéressants :
 +    * [[https://medium.com/python-in-plain-english/pie-chart-basics-with-pythons-matplotlib-972637f3c53e|Pie Chart Basics with Python’s Matplotlib]]
 +    * [[https://towardsdatascience.com/6-reasons-why-you-should-stop-using-histograms-and-which-plot-you-should-use-instead-31f937a0a81c|6 Reasons Why You Should Stop Using Histograms (and Which Plot You Should Use Instead)]] Histograms are not free of biases. Actually, they are arbitrary and may lead to wrong conclusions about data. If you want to visualize a variable, better to choose a different plot. Samuele Mazzanti, Medium, 24/01/2021
 +    * [[https://towardsdatascience.com/hands-on-guide-to-create-beautiful-sankey-charts-in-d3js-with-python-8ddab43edb43|Hands-on Guide to Create beautiful Sankey Charts in d3js with Python - The Sankey chart is a great way to discover the most prominent contributions just by looking at how individual items flow across states]] Erdogan Taskesen, Medium, 19/10/2022
  
- +===== Exemples =====
- +
- +
- +
-==== Exemples ====+
   * [[https://towardsdatascience.com/5-quick-and-easy-data-visualizations-in-python-with-code-a2284bae952f|5 Quick and Easy Data Visualizations in Python with Code]]   * [[https://towardsdatascience.com/5-quick-and-easy-data-visualizations-in-python-with-code-a2284bae952f|5 Quick and Easy Data Visualizations in Python with Code]]
   * Jupyter notebooks :    * Jupyter notebooks : 
Ligne 245: Ligne 270:
     * [[http://nbviewer.jupyter.org/url/jakevdp.github.com/downloads/notebooks/XKCD_plots.ipynb|XKCD plots in Matplotlib]] + [[http://nbviewer.jupyter.org/url/jakevdp.github.io/downloads/notebooks/XKCD_sketch_path.ipynb|ceci]]     * [[http://nbviewer.jupyter.org/url/jakevdp.github.com/downloads/notebooks/XKCD_plots.ipynb|XKCD plots in Matplotlib]] + [[http://nbviewer.jupyter.org/url/jakevdp.github.io/downloads/notebooks/XKCD_sketch_path.ipynb|ceci]]
   * [[https://github.com/naveenv92/python-science-tutorial|Python Science Tutorials]] Naveen Venkatesan, contains a series of scripts and notebooks to help people get acclimated to using Python for scientific publications.   * [[https://github.com/naveenv92/python-science-tutorial|Python Science Tutorials]] Naveen Venkatesan, contains a series of scripts and notebooks to help people get acclimated to using Python for scientific publications.
 +
  • teaching/progappchim/matplotlib_simple.1610364644.txt.gz
  • Dernière modification : 2021/01/11 12:30
  • de villersd