#导入matplotlib
import matplotlib.pyplot as plt
from numpy.random import randn
import numpy as np
fig = plt.figure(figsize=(8,6))
ax1 = fig.add_subplot(2,2,1)
ax2 = fig.add_subplot(222)
ax3 = fig.add_subplot(223)
plt.plot(randn(50).cumsum(),'k--') #在最后一个子图上绘制
ax1.hist(randn(50),bins=50)
ax2.scatter(np.arange(20),np.arange(20)+3*randn(20))
plt.show()