Alc*_*ott 27 python image matplotlib
我使用Python lib matplotlib来绘制函数,我知道如何在一个图中绘制不同子图中的几个函数,就像这个一样,
在处理图像时,我使用imshow()来绘制图像,但是如何使用一个图形在不同的子图中一起绘制多个图像?
mgi*_*son 43
该文件提供了一个例子(约四分之三的方式下页):
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import numpy as np
fig = plt.figure()
a=fig.add_subplot(1,2,1)
img = mpimg.imread('../_static/stinkbug.png')
lum_img = img[:,:,0]
imgplot = plt.imshow(lum_img)
a.set_title('Before')
plt.colorbar(ticks=[0.1,0.3,0.5,0.7], orientation ='horizontal')
a=fig.add_subplot(1,2,2)
imgplot = plt.imshow(lum_img)
imgplot.set_clim(0.0,0.7)
a.set_title('After')
plt.colorbar(ticks=[0.1,0.3,0.5,0.7], orientation='horizontal')
# ---------------------------------------
# if needed inside the application logic, uncomment to show the images
# plt.show()
Run Code Online (Sandbox Code Playgroud)
基本上,它与你通常创建轴一样fig.add_subplot...
| 归档时间: |
|
| 查看次数: |
63434 次 |
| 最近记录: |