123456789101112131415161718 |
- #! /usr/bin/env python3
- # https://pythonguides.com/python-plot-multiple-lines/
- # Importing packages
- import matplotlib.pyplot as plt
- # Define data values
- x = [7, 14, 21, 28, 35, 42, 49]
- y = [5, 12, 19, 21, 31, 27, 35]
- z = [3, 5, 11, 20, 15, 29, 31]
- # Plot a simple line chart
- plt.plot(x, y, 'g', label='Line y')
- # Plot another line on the same chart/graph
- plt.plot(x, z, 'r', label='Line z')
- plt.legend()
- plt.show()
|