Welcome! A plot is a picture of your data that helps you see patterns a table of numbers can't show. To create plots in Python, we use a powerful library called Matplotlib.
Engagement Message
What makes a visual pattern easier to recognize than a numerical one?
To get started, we need to import the library. Just as we use import pandas as pd
, the standard convention for Matplotlib's plotting interface is:
import matplotlib.pyplot as plt
Engagement Message
From now on, we'll use plt
to refer to Matplotlib, sound good?
Every plot begins with a Figure and Axes. Think of the Figure
as the entire canvas or window. The Axes
is the specific area inside the canvas where your data will actually be plotted.
Engagement Message
What is the relationship between a picture frame and the photo inside it?
We create the Figure and Axes with one simple command:
fig, ax = plt.subplots()
This creates a blank canvas (fig
) and a plotting area (ax
) for us to work with. ax
is the object we'll use to create our bars, lines, and points.
