Introduction to matplotlib Data Visualization for Python

Video demonstrations of introductory data visualization and plotting techniques in Python with matplotlib. Tutorials show fundamental concepts from the matplotlib library with downloadable Jupyter Notebooks. These concepts are consistent with Python and matplotlib development using other IDE interfaces. Almost all of the aspects of graphing described in these tutorials can be used in other types of visualizations that utilize matplotlib

Matplotlib is the de facto standard for data visualization with Python. While there are many other graphics libraries available almost everyone of them is a wrapper around the matplotlib library. Matplotlib is a third party library that does not come installed with the Python standard library. You can either install it and its dependencie using your package manager of choice, or have it installed automatically when you install a scientific platform such as Anaconda.

Visualization with matplotlib can be tedious and daunting if you don't know the basics. These videos are designed to get you started with a baseline knowledge that you will draw on again and again to make visulationzations with Python.

matplotlib tutorial notebooks:

Download Asset

the file used in the line plots video here

IPYNB — Jupyter Notebook
Download File

Download Asset

the file used in the histogram video here

IPYNB — Jupyter Notebook
Download File

Download Asset

the file used in the scatter plots video here

IPYNB — Jupyter Notebook
Download File

Line Plots with matplotlib

In this video:

  • Importing Google and Amazon stock prices
  • A basic line plot with plt.plot, and layering several lines on one chart
  • Figure size, legend placement and gridlines
  • Titles, axis labels, axis limits and custom ticks
  • Named, hex and RGB colors
  • Built-in styles such as ggplot and fivethirtyeight

Scatter Plots with matplotlib

In this video:

  • Calculating returns for Google and Amazon
  • A scatter plot of one stock's returns against the other's
  • Horizontal and vertical guide lines
  • Adding a third variable with a colormap
  • Applying a Seaborn style
  • Bubble charts with the s size parameter
  • Fixing overplotting with alpha blending


Histograms & Bar Graphs with matplotlib

In this video:

  • Setting bins and figure size
  • Color, edge color, gridlines and transparency with alpha
  • Plotting several distributions on one histogram
  • Normalizing with the density parameter and overlaying a normal distribution from SciPy stats
  • Annotating the mean and standard deviation, with LaTeX for the μ and σ symbols
  • Bar charts of categorical data (a census example) with data labels added in a loop
  • Horizontal bar charts with barh


Advertisement