How to Make a Line Plot with Pandas and Matplotlib in a Jupyter Notebook
How to Create a Simple Line Plot, add Axis Labels and Title, Customize Axis Ticks, add a Second Line Plot, and add a Legend
8 min readJun 8, 2020
Documentation for how to create a common visualization using Python, Jupyter Notebook, and Pandas.
This documentation assumes some familiarity with these tools, but not too much. You really just need to be able to get a notebook open and use a keyboard to succeed here.
Let’s dive in!
Table of Contents:
- Getting Set up
- Grab Data, Create Dataframe
- Filter Dataframe using .loc
- Plot Line
- Change Figure Size
- Customize Ticks with set_major_locator
- Add Axis Labels and Title
- Plot 2nd Line
- Add Legend Labels