【发布时间】:2020-06-11 20:52:28
【问题描述】:
我正在尝试将多个直方图放在垂直堆栈中。我能够在堆栈中获取图,但是所有直方图都在同一个图中。
fig, ax = plt.subplots(2, 1, sharex=True, figsize=(20, 18))
n = 2
axes = ax.flatten()
for i, j in zip(range(n), axes):
plt.hist(np.array(dates[i]), bins=20, alpha=0.3)
plt.show()
【问题讨论】:
-
for i, ax in zip(range(n), axes):,ax.hist(....).
标签: python matplotlib histogram