A follow on to the question How to remove the space between subplots in matplotlib.pyplot?, After multiple attemps at creating subplots with no space between them I have discovered that all solutions do not apply to polar projections. Both of the code samples below will work correctly if the polar projections is removed (that is show subplots side by side with no white space) but when the polar is added, white space shows up between the columns.
Sample 1
m,n,_ = ws.shape
fig,axs = plt.subplots(m,n,
subplot_kw=dict(projection='polar'),
gridspec_kw={'wspace':0,'hspace':0})
for i in range(m):
for j in range(n):
ax = axs[i][j] # current axes
w = ws[i][j] # current weight vector
a = numpy.linspace(0,2*numpy.pi,len(w),endpoint=False)
a = numpy.concatenate((a,[a[0]]))
w = numpy.concatenate((w,[w[0]]))
ax.fill(a,w,alpha=1.0)
ax.set_thetagrids([])
ax.set_yticklabels([])
ax.set_rticks([])
plt.show()
Sample 2
m,n,_ = ws.shape
fig = plt.figure()
gs = gridspec.GridSpec(m,n,width_ratios=[1,1,1,1,1,1],wspace=0.0,hspace=0.0)
for i in range(m):
for j in range(n):
ax = plt.subplot(gs[i,j],projection='polar')
w = ws[i][j] # current weight vector
a = numpy.linspace(0,2*numpy.pi,len(w),endpoint=False)
a = numpy.concatenate((a,[a[0]]))
w = numpy.concatenate((w,[w[0]]))
ax.fill(a,w,alpha=1.0)
ax.set_thetagrids([])
ax.set_yticklabels([])
ax.set_rticks([])
plt.show()
I have also toyed with changes parameters in matplotlibrc as suggested in other answers. Has anybody come up with a solution to this?