I'm trying to reproduce an example by Thucydides411 on How to remove gaps between subplots in matplotlib? using the following code:
import matplotlib.pyplot as plt
fig = plt.figure(figsize=(8,8)) # Notice the equal aspect ratio
ax = [fig.add_subplot(2,2,i+1) for i in range(4)]
for a in ax:
a.set_xticklabels([])
a.set_yticklabels([])
a.set_aspect('equal')
fig.subplots_adjust(wspace=0, hspace=0)
plt.show()
Since the figure size has an equal aspect ratio, I would expect the subplots to have no gaps between them. However, what I see is the following:
Although there is no vertical gap, there is a small horizontal gap. Any ideas why this is not working as it did for Thucydides411?