from matplotlib import pyplot as plt
plt.figure(1)
plt.plot([1,2,3],[1,4,9])
plt.ylabel('This is the y Axis')
plt.xlabel('This is the x Axis')
plt.title('This is the first graph')
plt.figure(2) plt.plot([2,4,5],[2,7,19])
plt.ylabel('This is the y Axis')
plt.xlabel('This is the x Axis')
plt.title('This is the second graph')
plt.show()
#Put 2 lines on the same graph
plt.plot([2,4,5],[2,7,19])
plt.plot([1,3,5],[2,3,8])
plt.ylabel('This is the y Axis')
plt.xlabel('This is the x Axis')
plt.title('This is the second graph')
plt.legend(['Data Set 1', 'Data Set 2']) #takes a list of strings
plt.show()
#Save the graph to a file
plt.plot([2,4,5],[2,7,19])
plt.plot([1,3,5],[2,3,8])
plt.ylabel('This is the y Axis')
plt.xlabel('This is the x Axis')
plt.title('This is the second graph')
plt.legend(['Data Set 1', 'Data Set 2']) #takes a list of strings
plt.savefig('exported_image')