Introduction to NumPy and Matplotlib
Chapter 9: Matplotlib
Multiple plots
Task 4: Sharing is caring!
Plot y
AND z
against x
on the same graph!
import numpy as np
import matplotlib.pyplot as plt
resolution = 1000
x = np.linspace(0, 50, resolution)
y = np.sin(x)
z = np.exp(y)
plt.figure(1)
plt.plot(x, y)
plt.plot(x, z)
plt.title("My Graph")
plt.xlabel("Time (s)")
plt.ylabel("Amplitude (W)")
plt.show()