如何使用matlib函数plt.imshow(图像)显示多个图像?
例如我的代码如下:
for file in images:
process(file)
def process(filename):
image = mpimg.imread(filename)
<something gets done here>
plt.imshow(image)
Run Code Online (Sandbox Code Playgroud)
我的结果显示只有最后处理的图像才能有效地覆盖其他图像
我想创建一个功能,在一个窗口中在屏幕上绘制一组图形.到现在为止我写这段代码:
import pylab as pl
def plot_figures(figures):
"""Plot a dictionary of figures.
Parameters
----------
figures : <title, figure> dictionary
"""
for title in figures:
pl.figure()
pl.imshow(figures[title])
pl.gray()
pl.title(title)
pl.axis('off')
Run Code Online (Sandbox Code Playgroud)
它工作得很好,但我想有选择在单个窗口中绘制所有数字.而这段代码没有.我读了一些关于subplot的东西,但看起来很棘手.