Python - Overlap of figures with matplotlib -
i have plot subplots in matplolib, have overlaps , cant correct can see below :
i try that, but, cant move each plots...an other way remove number "pixels" of grid (not plt.axis(off)! keep grid right , middle plots)
plt.close() fig, axes = plt.subplots(nrows=1, ncols=3) plt.tight_layout(pad=0.1, w_pad=1, h_pad=2.0) ax1 = plt.subplot(131) # creates first axis ax1.set_xticks([0,2000,500,1000,1500]) ax1.set_yticks([0,2000,500,1000,1500]) i1 = ax1.imshow(u,cmap='hot',extent=(x.min(),2000,y.min(),2000)) plt.colorbar(i1,ax=ax1,ticks=[u.min(),(u.min()+u.max())/2., u.max()],fraction=0.046, pad=0.04,format='%.2f') ax1.set_title("$ \mathrm{ux_{mes} \/ (pix)}$") ax2 = plt.subplot(132) # creates second axis ax2.set_xticks([0,2000,500,1000,1500]) ax2.set_yticks([0,2000,500,1000,1500]) i2=ax2.imshow(uu,cmap='hot',extent=(x.min(),2000,y.min(),2000)) ax2.set_title("$\mathrm{ux_{cal} \/ (pix)}$") plt.colorbar(i2,ax=ax2,fraction=0.046, pad=0.04,ticks=[uu.min(),(uu.min()+uu.max())/2.,uu.max()],format='%.2f') ax3 = plt.subplot(133) # creates first axis ax3.set_xticks([0,2000,500,1000,1500]) ax3.set_yticks([0,2000,500,1000,1500]) i3 = ax3.imshow(resu,cmap='hot',extent=(x.min(),2000,y.min(),2000)) ax3.set_title("$\mathrm{\mid ux_{mes} - ux_{cal} \mid \/ (pix)}$ ") plt.colorbar(i3,ax=ax3,fraction=0.046, pad=0.04,ticks=[resu.min(), (resu.min()+resu.max())/2.,resu.max()],format='%.2f') #plt.savefig('test.eps', format='eps', dpi=1000, bbox_inches='tight', pad_inches=0.1) plt.savefig('test.png', bbox_inches='tight', pad_inches=0.1) #plt.show()
this remove tick labels on vertical axis in middle , right plots (which think mean when 'remove number "pixels"'):
ax2.set_yticklabels([]) ax3.set_yticklabels([])
Comments
Post a Comment