100 days of code: Day 23 - matplotlib

Last modified on 2020-07-01

Source: 100-days-of-code.

Install matplotlib, a Python mathematical plotting library used to generate line graphs …

$ sudo apt install python3-matplotlib

Create a program - mpl_squares.py - that generates a list of numbers squared and draws a line plot …

#!/usr/bin/env python3
import matplotlib.pyplot as plt

squares = []

for i in range(1, 10):

# subplots() can generate one or more plots in the same figure. Variable 'fig'
# represents the entire figure or collection of plots generated. Variable 'ax' 
# represents a single plot in the figure.
fig, ax = plt.subplots()


Run program and display graph …


Happy hacking!