扩展matplotlib图输出

时间:2019-06-18 12:16:15

标签: python matplotlib seaborn

我正在尝试绘制多个图,这是代码:

import seaborn as sns
import matplotlib.pyplot as plt

fig, axes = plt.subplots(round(len(matching)/2), 2, figsize=(20, 25))
fig.subplots_adjust(hspace=2)

for i, col in enumerate(matching):
    # Method 1: on the same Axis
    ax = axes[i // 2, i % 2]
    sns.distplot(hcp_fs_by_hcp_new[col],ax=ax, kde_kws={"color":"r", "lw": 2, "label":"LA5"}, hist_kws={"label":"LA5","color": "r"})
    sns.distplot(hcp_fs_by_scoltech[col],ax=ax, kde_kws={"color":"g", "lw": 2, "label":"hcp"}, hist_kws={"label":"hcp"})
    ax.set_title(col)

plt.setp(axes, yticks=[])

plt.tight_layout()
plt.show()

并获得所有图都非常紧紧且受压的结果,如何通过滚动以固定大小输出它们?

how it looks now

0 个答案:

没有答案