= fig.add_subplot(1,1,1)
plt.plot(x, y)
plt.savefig('example.png')
出图效果如下:
?...只不过fig.add_subplot(1,1,1)表示的是这个名为fig的空白画布中,总共有1行,1列,ax为其第1个子图。...]
y = [1,0,2,4]
fig = plt.figure()
ax1 = fig.add_subplot(2,2,1) #或:plt.subplot(2,2,1)
plt.plot(x, y)...),还是直接写为plt.subplot(2,2,1)的形式,都表示接下来使用的plt绘图包中的函数,都是针对子图subplot(2,2,1)进行的设置,而并非整个画布fig。...plt.plot(x, y)
plt.title('b) ',fontsize=14,color='blue')
plt.subplot(2,1,2)
plt.plot(x, y)
plt.title(