How to make more space for subset text fields in python matplotlib?

How to make room for text fields in Python matplotlib? Now it looks too dirty: some text fields go one above the other.

Here is part of the current code for the drawing:

fig_a = fig.add_subplot(2,2,i) fig_a.set_title(r'$T_{0} = %.3g N/m, V_{0} = %.6g$ m/s' % (counter, V0)) fig_a.plot(xx,f) plt.xlim(-kappa,kappa) plt.xlabel(r'$\eta$') plt.ylim(-0.1,1.1) if ((i == 1) or (i == 3)): plt.ylabel(r'$f(\eta)$') i = i + 1 

How to change this so as not to look so dirty?

+4
source share
2 answers
 fig.subplots_adjust(left=None, bottom=None, right=None, top=None, wspace=None, hspace=None) 

You want to change hspace, the vertical space between the subheadings: I found that hspace = 0.4 looked fine with your code, but YMMV.

+3
source

you can also try

  pylab.tight_layout() 

works fine for me, and also allocates some more space in the corners for themseves charts.

0
source

Source: https://habr.com/ru/post/1338097/


All Articles