0

I want to represent different plots on a figure but when i try to save, the figure is too important and i cant get all it...it execeeds the "borders" as you can see below : My code is :

fig, axes = plt.subplots(nrows=1, ncols=3)
plt.tight_layout(pad=0.01, w_pad=2, h_pad=1.0)
ax1 = plt.subplot(131) # creates first axis
ax1.set_xticks([0,2000,500,1000,1500])
ax1.set_yticks([0,2000,500,1000,1500])
ax1.imshow(U,cmap='hot',extent=(X.min(),2000,Y.min(),2000));
ax1.set_title("$ 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])
ax2.imshow(UU_mask,cmap='hot',extent=(X.min(),2000,Y.min(),2000))
ax2.set_title("$Ux_{cal} \/ (pix)$")
ax3 = plt.subplot(133) # creates first axis
ax3.set_xticks([0,2000,500,1000,1500])
ax3.set_yticks([0,2000,500,1000,1500])
ax3.imshow(resU,cmap='hot',extent=(X.min(),2000,Y.min(),2000))
ax3.set_title("$\mid Ux - Ux \mid \/ (pix)$ ")

plt.savefig('test.png')

enter image description here

1 Answer 1

1

fig.savefig can adjust the padding it gives the figure. Try something like

plt.savefig('test.png',  bbox_inches='tight', pad_inches=0.1)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.