我有这段代码可以绘制子图:
import matplotlib.pyplot as plt
columns = 4
rows = 2
fig, ax_array = plt.subplots(rows, columns,squeeze=False)
for i,ax_row in enumerate(ax_array):
for j,axes in enumerate(ax_row):
axes.plot([1,2,3], [1,2,3])
plt.show()
如何强制每个子图都为正方形(所以height = width)?