O'Reilly logo
live online training icon Live Online training

Visualization in Python with Matplotlib

enter image description here

Hands-on training for Matplotlib fundamentals

Topic: Data
Matt Harrison

You already work with data in Python. Visualizing your data can help you identify patterns and insights you couldn't see otherwise and helps you communicate those discoveries to people in a more accessible way.

Python expert Matt Harrison leads a hands-on primer on Matplotlib—the de facto library for plotting in Python. (Many other plotting libraries use Matplotlib as their foundation.) Over three hours, Matt walks you through using Matplotlib to discover patterns, find outliers, compare values, and communicate visually. Join in to get started with the library that data scientists and programmers use to create beautiful plots (as PDF, SVG, or PNG files) and enhance plots from other libraries.

What you'll learn-and how you can apply it

By the end of this live online course, you’ll understand:

  • Why Matplotlib was developed
  • The programming interfaces that the library offers
  • How other tools relate to Matplotlib

And you’ll be able to:

  • Create plots using Matplotlib
  • Adjust the styling of the plots
  • Annotate the plots

This training course is for you because...

  • You're a Python developer who wants to learn how to use Matplotlib.
  • You're a data scientist who needs to visualize results. Matplotlib lies at the heart of most Python visualization tools.


  • A basic knowledge of Python (e.g., the ability to create strings, use lists of data, and call functions)

Recommended follow-up:

  • Read "Visualization with Matplotlib" (chapter 4 in Python Data Science Handbook)
  • Read the section on plotting in Learning the Pandas Library
  • Install Jupyter and Matplotlib on your own machine and run through the "Usage Guide" on the Matplotlib website

About your instructor

  • Matt runs MetaSnake, a Python and Data Science training and consulting company. He has over 15 years of experience using Python across a breadth of domains: Data Science, BI, Storage, Testing and Automation, Open Source Stack Management, and Search.


The timeframes are only estimates and may vary according to how the class is progressing

Introduction to Jupyter (15 minutes)

  • Lecture: A refresher on the Jupyter environment

Introduction to Matplotlib (20 minutes)

  • Lecture and guided walkthrough: Take a simple time series dataset, make a simple plot, and then gradually enhance it by illustrating various features of Matplotlib

Interfaces (20 minutes)

  • Lecture: Using Matplotlib's two interfaces—one that mimics Matlab and the other its object-oriented interface; best practices
  • Hands-on exercise: Create a plot using a rich dataset about cars and fuel efficiency, using the object-oriented interface and the stateful interface, and then tweak the output

Break (10 minutes)

Basic plots (20 minutes)

  • Lecture: Plotting line, bar, and scatter plots
  • Hands-on exercise: Create these types of plots using the fuel efficiency data

Architecture (20 minutes)

  • Lecture: Matplotlib's hierarchy of components; the different parts of the plots
  • Hands-on exercise: Create a plot and adjust the ticks and the spine

Annotating charts (15 minutes)

  • Lecture: Using annotation to highlight important parts of the plot and draw attention to values
  • Hands-on exercise: Create a bar plot, removing the labels along the y axis and embedding them directly into the individual bars

Break (10 minutes)

Configuring Matplotlib (20 minutes)

  • Lecture: Using Matplotlib's default settings to control the look of the plots
  • Hands-on exercise: Change and customize these settings, adjusting colors, line width, and line style

Interactive plots in Jupyter (15 minutes)

  • Lecture: Using Juypter to enhance your plot and make it interactive
  • Hands-on exercise: Use a widget to dynamically change the plot result

3D and other tools (15 minutes)

  • Lecture: Other tools built on top of Matplotlib—3D plotting, pandas, and seaborn
  • Hands-on exercises: Create a 3D plot; adjust a plot made with pandas