python - matplotlib basemap subplot overlaps -


i trying generate subplots of geo maps using basemap. here section of code working on:

import matplotlib.pyplot plt #---some code read in data # ...  #-----get a4 sized landscape figure fig=plt.figure(figsize=(11.69,8.27), dpi=100)  #----2*3 subplots------------- ii in range(6):     ax=fig.add_subplot(2,3,ii+1)      #---basemap contourf of data     baseisofill(var[ii],ax,'local')     ax.set_title('(a)',loc='left')   #plt.tight_layout() plt.tight_layout(pad=2.0,h_pad=6.5,w_pad=4.5) plt.show()  

problem subplot layouts:

  • without tight_layout(), plots , texts in subplots won't overlap, ended small , don't make full use of figure space (fig.1).
  • with plt.tight_layout(), subplots take of available figure space latitude lables starts overlap (fig.2).
  • plt.tight_layout(pad=2.0,h_pad=6.5,w_pad=4.5) gives desired result (fig.3). parameters need changed when different subplot layout used (e.g. 3*2 on landscape a4, fig.4, small again).

2x3 subplots without <code>tight_layout()</code>, small 2x3 subplots <code>tight_layout()</code>, overlaps 2x3 subplots <code>tight_layout((pad=2.0,h_pad=6.5,w_pad=4.5)</code>, desired result 3x2 subplots same <code>tight_layout(pad=2.0,h_pad=6.5,w_pad=4.5)</code> in fig.3, small again

in baseisofill() function, scaled down font size latitude labels trying avoid overlaps. downscaling function of subplot layout (fontsize=7./max(nrows,ncolns)+5). other this, no other size-related changes made inside function.

if spend time tuning padding parameters result, involve trial , error tests , not robust. after all, giving quick , robust fix subplot layouts tight_layout about. wonder has come solution this?

ps: matplotlib version 1.3.1. basemap version 1.0.7


Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -