首页 > 解决方案 > 我无法从 jupyter 笔记本中的 matplotlib.pyplot 关闭无花果

问题描述

windows python 3.7.3 matplotlib 3.0.3

for raw_name in img_list: 
            img1 = np.asarray(Image.open(os.path.join(ROOT, raw_name)))
            img2 = np.asarray(Image.open(os.path.join(ROOT, raw_name.replace('.jpg', '.png'))))
            f, axarr = plt.subplots(1, 2, dpi=400, frameon=False, gridspec_kw={'width_ratios': [6, 1]})
            plt.ion()
            axarr[0].imshow(img1)
            plt.axis('off')
            axarr[1].imshow(img2)
            plt.axis('off')

            plt.show(block=False)
            plt.close('all')

我想在每个循环中显示图像并通过在每个循环结束时关闭绘图来刷新输出。但结果只是一张一张地显示图像。谁能告诉我如何关闭 jupyter notebook 中的情节?

标签: pythonmatplotlibjupyter-notebook

解决方案


推荐阅读