我正在尝试使用 Seaborns 子图方法在垂直列中绘制三个热图。
import seaborn as sns
initalCorr = inputX.corr()
secondaryCorr = inputX_corr.corr()
finalCorr = inputX[selected_columns_pvalue].corr()
fig, axs = plt.subplots(3, figsize = (15,45))
fig.suptitle('Heatmaps of correlation between features selected for training',
fontsize = 20)
sns.heatmap(data = initalCorr, center = 0, square = True, ax = axs[0])
axs[0].set_title('Correlation between all features', fontsize = 20)
sns.heatmap(secondaryCorr, center = 0, square = True, annot = True, linewidths = .5, fmt = '.2f', ax = axs[1])
axs[1].set_title('Correlation between features slected for P-Value analysis', fontsize = 20)
sns.heatmap(finalCorr, center = 0, square = True, annot = True, linewidths = .5, fmt = '.2f', ax = axs[2])
axs[2].set_title('Correlation between finally selected features', fontsize = 20)
图表本身绘制得很好,但标题相对于图表显得格格不入。
如何将标题直接放在热图上方?
附加:seaborn 0.9.0 版 matplotlib 3.0.3 版