Matplotlib Line Charts

The default plot style in matplotlib is the line chart. Matplotlib line charts are very easy to create an allow you to speculate about how missing data might look.  The line chart plots each point on a grid, and then draws lines between those points.

To build a line chart with matplotlib, first make sure you import matplotlib into your program using:

  • import matplotlib.pyplot as plt

Then you will need two lists of data points, one for x and one for y. Create your chart with plt.plot(x,y) and show it with plt.show()

The line chart extrapolates relationships between your data.