Python:希望在同一窗口中显示多个图形

时间:2018-10-11 19:41:23

标签: python matplotlib plot

我很难让我的四个图显示在同一个窗口中,而没有它们a)覆盖或b)出现错误:

  

[AttributeError:“ AxesSubplot”对象没有属性“ plt”]

这是我要修复的代码部分:

if(debug_on):      
    fig, axs = plt.subplots(2,2,sharex=True, sharey=True)
    img_1 = remap.pedf(upsampled_smoothed_mag1)
    im_1 = axs[0,0].plt.imshow(img_1,aspect='auto',origin='lower',extent=[0,img_1.shape[1],0,img_1.shape[0]])                            
    fig.colorbar(im_1),
    plt.title('Unsampled smoothed - 1')
    plt.show()
    plt.pause(0.05)

    img_2 = remap.pedf(upsampled_smoothed_mag2)
    im_2 = axs[0,1].plt.imshow(img_2,aspect='auto',origin='lower',extent=[0,img_2.shape[1],0,img_2.shape[0]])
    fig.colorbar(im_2)
    plt.title('Unsampled smoothed - 2')
    plt.show()
    plt.pause(0.05)

    img_3 = remap.pedf(upsampled_smoothed_mag1_2)
    im_3 = axs[1,0].plt.imshow(img_3,aspect='auto',origin='lower',extent=[0,img_3.shape[1],0,img_3.shape[0]])                            
    fig.colorbar(im_3)
    plt.title('Unsampled smoothed - 1 (2.0)')
    plt.show()
    plt.pause(0.05)

    img_4 = remap.pedf(upsampled_smoothed_mag2_2)
    im_4 = axs[1,1].plt.imshow(img_4,aspect='auto',origin='lower',extent=[0,img_4.shape[1],0,img_4.shape[0]])
    fig.colorbar(im_4)
    plt.title('Unsampled smoothed - 2 (2.0)')
    plt.show()
    plt.pause(0.05)

预先感谢您的帮助!附言我非常新手!

0 个答案:

没有答案
相关问题