This is a good example that shows the benefit of using matplotlib
‘s object oriented API.
import numpy as np
import matplotlib.pyplot as plt
# Generate random data
data = np.random.rand(100)
# Plot in different subplots
fig, (ax1, ax2) = plt.subplots(1, 2)
ax1.plot(data)
ax2.plot(data)
ax1.plot(data+1)
plt.show()
Note: it is more pythonic to have variable names start with a lower case letter e.g. data = ...
rather than Data = ...
see PEP8