美文网首页
python图片-2-matplotlib库使用

python图片-2-matplotlib库使用

作者: Cookie_hunter | 来源:发表于2018-03-25 21:02 被阅读0次

让程序来绘制图片

matplotlib的库来绘制图片进行显示。matplotlib是一个专业绘图的库,相当于matlab中的plot,可以设置多个figure,设置figure的标题,甚至可以使用subplot在一个figure中显示多张图片。

from PIL import Image
import matplotlib.pyplot as plt

img = Image.open('pokemon.jpg')
plt.figure('pokemon')
plt.imshow(img)
plt.show()

figure默认是带axis的,如果没有需要,我们可以关掉

plt.axis('off')

相关文章

网友评论

      本文标题:python图片-2-matplotlib库使用

      本文链接:https://www.haomeiwen.com/subject/niukcftx.html