#### Create multiple columns and rows of unequal size in matplotlib

``````a = np.random.rand(20, 20)
b = np.random.rand(20, 5)
c = np.random.rand(5, 20)
d = np.random.rand(5,5)
arrays = [a,b,c,d]
fig, axs = plt.subplots(2, 2, sharex='col', sharey= 'row', figsize=(10,10))
for ax, ar in zip(axs.flatten(), arrays):
ax.imshow(ar)
``````

1 个回复

``````import numpy as np
import matplotlib.pyplot as plt

a = np.random.rand(20, 20)
b = np.random.rand(20, 5)
c = np.random.rand(5, 20)
d = np.random.rand(5,5)
arrays = [a,b,c,d]
fig, axs = plt.subplots(2, 2, sharex='col', sharey= 'row', figsize=(10,10),
gridspec_kw={"height_ratios" : b.shape,
"width_ratios" : b.shape})
for ax, ar in zip(axs.flatten(), arrays):
ax.imshow(ar)

plt.show()
``````

``````gridspec_kw={"height_ratios" : [a.shape[0], c.shape[0]],
"width_ratios" : [a.shape[1], b.shape[1]]}
``````
2 css中的卡片大小不等

3 Pandas：合并两个行和列大小不等的数据框，并根据下面的解释合并它们

4 1 列与样本大小不等的所有其他列之间的协方差

6 如何基于行值合并两个大小不等的数据框

7 谷歌饼图错误：行的大小不等于0

8 尝试创建大小不等R的方差分析表

2014-10-06 20:11:26 1 248   r/ anova
9 matplotlib geopandas 子图大小不等

10 大小不等的Tensorflow TFrecord文件