我正在尝试重现 Thucydides411 在 How to remove gaps between subplots in matplotlib? 上的示例使用以下代码:
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()
由于图形大小具有相同的长宽比,我希望子图之间没有间隙。然而,我看到的是以下内容:
虽然没有垂直间隙,但水平间隙却很小。知道为什么这不像 Thucydides411 那样有效吗?
最佳答案
关于python - 生成方形子图,子图之间没有间隙,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38873354/