matplotlib使用 发表于 2018-09-Sat | 阅读次数: 笔者一直云里雾里网上复制着用用,这次打算弄懂闭着眼用。1234567891011121314151617import numpy as npimport matplotlib.pyplot as pltplt.figure(1) plt.figure(2) ax1 = plt.subplot(211) ax2 = plt.subplot(212)x = np.linspace(0, 3, 100)for i in xrange(5): plt.figure(2) plt.plot(x, np.exp(i*x/3)) plt.sca(ax1) plt.plot(x, np.sin(i*x)) plt.sca(ax2) plt.plot(x, np.cos(i*x))plt.show()使用流程112341. plt.figure()2. plt.imshow(img)3. plt.plot()4. plt.show()使用流程21234561. plt.figure()2. ax = plt.subplot(211)3. plt.sca(ax)4. plt.imshow(img)5. plt.plot()6. plt.show()请作者喝一杯咖啡☕️打赏微信支付