python使用pylab一幅圖片畫多個圖


import numpy as np
import pylab as pl

if __name__ == '__main__':
fig = pl.figure(figsize=(10, 5))
ax = fig.add_subplot(121)
toplot = np.random.randint(0, 255, [40, 40])
pl.text(1, 3, 'Left picture', fontsize=20)
pl.imshow(toplot)
ax = fig.add_subplot(122)
toplot = np.random.randint(0, 2, [40, 40])
pl.text(1, 3, 'Right picture', fontsize=20)
pl.imshow(toplot)
pl.savefig('image_%d.png' % 0)

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM