matplotlib is one of the core (Python) libraries or packages in the well-known, open-source ecosystem Scipy. Like the other packages in Scipy, it is widely used in mathematical and statistical, scientific and engineering circles. Unlike the other packages, it's primary focus is on 'data visualization,' or more specifically on 2D (and secondarily 3D) charting. While it has unique cababilities, it is rarely used alone. Instead, it works hand-in-hand with the other core elements of Scipy, especially numpy and pandas which provide their on unique data preparation and analysis features.
matplotlib is 'designed to reproduce as much as possible' the graphic capabilities of Mathwork's extremely popular MATLAB. This means that not only does it have extensive capabilities, but it is also relatively straight forward and simple to use. Essentially, charts can be constructed and embellished in a step-by-step fashion, making it relatively easy for first time users to grasp. Towards this end, matplotlib can also be used in an interactive fashion either in an IPython interactive Python shell or a Jupyter Notebook.
There are a wide variety of sources covering in various levels of detail the 'introductory, intermediate, and advanced' features and function of matplotlib. This repository aims to summarize these sources, highlighting their contents and pointers to existing code and Jupyter notebooks.
- Source: Matplotlib.org's user's guide, gallery, and tutorials. This is the group responsible for developing and maintaining the library/package.
- Code: Both the extensive gallery of examples and the more in-depth tutorial guides provide downloadable zip files of Python code or Jupyter notebooks -- gallery_python.zip, gallery_jupyter.zip, tutorial _python.zip, and tutorial_jupyter.zip. This code can also be found on github/maptplotlib/matplotlib. Together they cover an enormous range of chart or plot types, as well as myriad of keyword and parameter settings.
- Source: The Scipy.Org Lectures covering various aspects of the core elements of the Scipy ecosystem. The Lectures can be found at http://scipy-lectures.org in both online, PDF, and github formats. Although Matplotlib is used throughout the Lectures, Section 1.5 of the lectures is devoted to Matplotlib and Section 16 also has heavy coverage of the library's capabilities (especially the use of figures with multiple subplots).
- Code: Associated programs are found on Github at https://github.com/scipy-lectures/scipy-lecture-notes/blob/master/intro/matplotlib/index.rst.
- Note: Currently, creating a Jupyter notebook based on the notes and programs.
- Source: Chapter 7 of Python Data Analysis with Pandas, Numpy and Matplotlib by Fabio Nelli, Apress, 2018. Explores a range of chart types including: Line, Histogram, Bar, Pie, Countour, Polar, 3D Surfaces, Scatterplots in 3D, Barcharts in 3D, Subplots and Grids of Subplots.
- Code: Jupyter Notebook found on Github at: https://github.com/meccanismocomplesso/python-data-analytics-2e/blob/master/Chapter%207%20-%20Data%20Visualization%20with%20matplotlib.ipynb. To access it in Jupyter's nbviewer use the following link: https://nbviewer.jupyter.org/github/meccanismocomplesso/python-data-analytics-2e/blob/master/Chapter%207%20-%20Data%20Visualization%20with%20matplotlib.ipynb
- Note: Complete code for the entire book is provided on the same Github site.
- Source: Matplotlib 3.0 Cookbook by Srinivasa Rao Poladi, Packt Publishing, 2018. Soup to nuts coverage of charting fundamentals, as well as discussions and examples of various aspects of the backend, artist and scripting layers. In Chapter 2, specific examples devoted to: Line plot, Bar plot, Scatter plot, Bubble plot, Stacked plot, Pie plot, Table chart, Polar plot, Histogram, Box plot, Violin plot, Heatmap, Hinton diagram, Images, Contour plot, Triangulations, Stream plot, and Path. In Chapter 3, focus is on multiple plots and subplots.
- Code: Jupyter Notebook found on Github at: https://github.com/PacktPublishing/Matplotlib-3.0-Cookbook.
- Source: Matplotlib for Python Developers - Second Edition by Aldrin Yim, Claire Chung, Allen Yu. Packt Publishers, April 2018. Practical, hands-on resource to help you visualize data with Python using the Matplotlib library. Shows you how to create attractive graphs, charts, and plots using Matplotlib. Also, provides quick introduction to third-party packages, Seaborn, Pandas, Basemap, and Geopandas, and learn how to use them with Matplotlib.
- Code: Jupyter Notebooks found on Github at: https://github.com/PacktPublishing/Matplotlib-for-Python-Developers-Second-Edition
- Source: Chapter 4 of Numerical Python: Scientific Computing and Data Science Applications with Numpy, SciPy and Matplotlib (2nd Edition) by Robert Johansson, Apress Publisher, 2019. Chapter 4 focuses on the use of matplotlib in generating and displaying the "plots and figures used to visualize results and data in scientific and technical disciplines, suc as line, bar, contour, colormap and 3D surface plots."
- Code: found on Github at https://github.com/Apress/numerical-python-second-ed/blob/master/ch04-code-listing.ipynb. To access it in Jupyter's nbviewer use the following link: https://nbviewer.jupyter.org/github/Apress/numerical-python-second-ed/blob/master/ch04-code-listing.ipynb
- Note: Complete code for the entire book is provided on the same Github site. To access it in Jupyter's nbviewer use the following link: https://nbviewer.jupyter.org/github/Apress/numerical-python-second-ed/blob/master/ch04-code-listing.ipynb
- Source: Matplotlib Tutorial: Python Plotting by Karlijn Willems, Dec 2019. Tutorial covers the basics Python data visualization including: anatomy of a Matplotlib plot; plot creation; plotting routines; basic plot customizations; saving, showing and clearing plots; and customizing plots.
- Code: Interactive code is provided within the tutorial. Additionally, Datacamp.com provides a Matplotlib 'cheat sheet' summarizing much of the discussion in the tutorial.
- Source: Chapter 13 of Pandas 1.x Cookbook: Practical recipes for scientific computing, time series analysis, and exploratory data analysis using Python, 2nd Edition by Matt Harrison and Theodore Petrou, Packt Publishing, 2020.
- Code: found on Github at https://github.com/PacktPublishing/Pandas-Cookbook-Second-Edition/blob/master/Chapter13/13-code.ipynb. To access it in Jupyter's nbviewer use the following link: https://nbviewer.jupyter.org/github/PacktPublishing/Pandas-Cookbook-Second-Edition/blob/master/Chapter13/13-code.ipynb.
- Source: Chapter 3 of Hands-On Exploratory Data Analysis with Python By Suresh Kumar Mukhiya, Usman Ahmed, Packt Publishing, 2020. Practice graphical exploratory analysis techniques using Matplotlib and the Seaborn Python package. Covers Line, Bar, Scatter, Bubble, Area and Stacked, Pie, Table Chart, Polar, Histogram and Lollipop plots.
- Code: found on Github at https://github.com/PacktPublishing/Hands-on-Exploratory-Data-Analysis-with-Python/blob/master/Chapter%202/Chapter_2_EDA.ipynb. To access it in Jupyter's nbviewer use the following link: https://nbviewer.jupyter.org/github/PacktPublishing/Hands-on-Exploratory-Data-Analysis-with-Python/blob/master/Chapter%202/Chapter_2_EDA.ipynb.
- Source: Python Plotting With Matplotlib (Guide) by Brad Solomon. 2017.
This article mixes theory and practice, providing a beginner-to-intermediate-level overview of matplotlib library and delving into some of it's inner workings and layout. The discussion of subplots and visualizing arrays is especially helpful. Although this was written in 2017, the examples still work.
- Code: Code snippets are contained in the article. A Jupyter notebook version of the code is in process.
- Source: Introduction to Matplotlib SciPy 2019 Tutorial by Hannah Aizenman and Thomas Caswell, 2019. Beginner's tutorial covering some of the fundamental concepts that underlie the architecture of Matplotlib along with plots that rest on "most of the common types of data -- such as discrete, continuous and categorical, in 1D and 2D..." This tutorial was inspired by and steals liberally from Benjamin Root's fantastic 'Anatomy of Matplotlib'.
- Code: Code is provided in a collection Juypter notebooks found on Github at: https://github.com/matplotlib/GettingStarted/tree/master/notebooks
- video: 3+ hour video of tutorial presentation on Youtube at: https://www.youtube.com/watch?v=Tr4DYo4v5AY
- Source: Anatomy of Matplotlib SciPy 2017 Tutorial by Ben Root, 2017. Introductory tutorial to Matplotlib, covering the basic types of plots along with Matplotlib's fundamental concepts and terminologies, as well as some of the toolkits used to extend the library.
- Code: Collection of Jupyter notebooks found on Github at: https://github.com/matplotlib/AnatomyOfMatplotlib
- Video: https://www.youtube.com/watch?v=rARMKS8jE9g