如何在jupyter笔记本中逐行绘制4000张图像?

乌尔多安(Vural Erdogan)

我想以子图或其他方法逐行绘制4000张图像。当我使用子图方法时,显示的图像尺寸以某种方式减小。我想解决这个问题,并了解是什么导致绘图大小减小,或者学习其他绘制图像的方法。

for ix in range(0, len(preds_train_t)):
    fig = plt.figure()
    #ix = random.randint(0, len(preds_train_t))
    fig.add_subplot(ix+1, 3, 1) 
    plt.imshow(np.dstack((X_train[ix],X_train[ix],X_train[ix])))   

    tmp = np.squeeze(Y_train[ix]).astype(np.float32)
    fig.add_subplot(ix+1, 3, 2) 
    plt.imshow(np.dstack((tmp,tmp,tmp)))

    tmp = np.squeeze(preds_train_t[ix]).astype(np.float32)
    fig.add_subplot(ix+1, 3, 3) 
    plt.imshow(np.dstack((tmp,tmp,tmp)))
    plt.show()

Jupyter笔记本的结果:

在此处输入图片说明

乌尔多安(Vural Erdogan)
for ix in range(0, len(preds_train_t)):
        fig = plt.figure()
        #ix = random.randint(0, len(preds_train_t))
        fig.add_subplot(1, 3, 1) 
        plt.imshow(np.dstack((X_train[ix],X_train[ix],X_train[ix])))   

        tmp = np.squeeze(Y_train[ix]).astype(np.float32)
        fig.add_subplot(1, 3, 2) 
        plt.imshow(np.dstack((tmp,tmp,tmp)))

        tmp = np.squeeze(preds_train_t[ix]).astype(np.float32)
        fig.add_subplot(1, 3, 3) 
        plt.imshow(np.dstack((tmp,tmp,tmp)))
        plt.show()

我已经将“ ix + 1”更改为“ 1”,并且问题已解决,因为循环导致jupyter笔记本中出现新行以进行绘图。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

如何在Jupyter笔记本(iPython)中并排显示2张图像?

如何在 Google Colab 中的笔记本中显示图像(如在 Anacondan Jupyter Notebook 中)?

如何在Jupyter笔记本中的R输出中显示图像表?

如何在Jupyter笔记本中嵌入gif?

如何在Jupyter笔记本中包装代码/文本

如何在Jupyter笔记本中配置缩进大小?

如何在Jupyter笔记本中对熊猫使用tqdm?

如何在jupyter笔记本中安装sympy

如何在Pycharm笔记本中停止Jupyter Server

如何在ipython笔记本中重新加载图像?

如何在ipython笔记本中显示PIL图像

如何在Jupyter笔记本中显示一个单元格中的多个图像

无法在Jupyter笔记本中绘制Pandas数据框

如何在jupyter笔记本中使用python向图像添加视觉注释?

在jupyter笔记本中显示图像网格

如何从本地计算机或Web资源将图像或图片嵌入jupyter笔记本中?

如何在 Jupyter 笔记本上导入 openCV?

如何在for循环中运行jupyter笔记本宏

如何在conda环境中使用Jupyter笔记本?

如何在Jupyter笔记本中键入“是”或“否”

如何在Travis CI上测试Jupyter笔记本?

如何在Jupyter笔记本方程式的文本中添加空格?

如何在jupyter笔记本中跨单元格创建编号列表?

如何在PowerShell中为“ jupyter笔记本”设置别名?

如何在我的jupyter笔记本中添加python3内核?

如何在GCP AI平台Jupyter笔记本中安装Cloud Filestore?

如何在ipython / jupyter笔记本中修改Reveal.js幻灯片设置

如何在绘图时从jupyter笔记本中删除显示的matplotlib输出行

如何在Jupyter笔记本中运行Python异步代码?