I have 5 maps I am trying to plot in one figure. I would like them to be laid out like
1 2 3
4 5
To do this, I tried to follow the answer given here: Position 5 subplots in Matplotlib
This gives me the correct layout, but there is a ton of empty space left between the subplots.
#S,W,N,E Bounds
lonMin = 119
lonMax = 124
latMin = 12
latMax = 19
m = Basemap(llcrnrlon=lonMin,llcrnrlat=latMin,urcrnrlon=lonMax,urcrnrlat=latMax, projection = 'cea', resolution = 'i')
fig = plt.figure()
axes = [plt.subplot2grid(shape=(2,6), loc=(0,0), colspan=2),
plt.subplot2grid((2,6), (0,2), colspan=2),
plt.subplot2grid((2,6), (0,4), colspan=2),
plt.subplot2grid((2,6), (1,1), colspan=2),
plt.subplot2grid((2,6), (1,3), colspan=2)]
for i in range(5):
m.ax = axes[i]
m.drawcoastlines()
fig.suptitle('Title', fontsize = 20, fontweight = 'bold')
How can I reduce the spacing between the subplots?
EDIT:
The problem appears to somehow be tied to putting Basemaps in the plot. If I comment out the m.drawcoastlines()
call, the axes look like this, which is fine: