0

I want to have a matplotlib figure without ANY padding. Currently I do this manually via the IPython (Spyder3) interactive window and its configure subplots window. As shown in this figure.

I need to automate this process and decided to have a look at the Tight layout options.

fig.set_tight_layout(True)
fig.tight_layout(rect=[0, 0, 1, 1])

This does not result in the intended result as some margins do still remain. As shown here.

How do I force figures to have no padding at all. I expect the setting to exist as I'm able to change it in the GUI of IPython.

aijLag
  • 27
  • 6

1 Answers1

0

The GUI option you're using can be coded with the plt.subplots_adjust command. Something like plt.subplots_adjust(left=0, right=1, top=1, bottom=0) should achieve what you want

jwalton
  • 5,286
  • 1
  • 18
  • 36