Python 如何在matplotlib中旋转轴标题?

Python 如何在matplotlib中旋转轴标题?,python,matplotlib,Python,Matplotlib,我无法在y轴和x轴上旋转名称,使它们重叠。我做错了什么 yticks/xticks(旋转=90)也不会调整名称以防止它们重叠 name = 'Anne Frank Diary' df4 = df.loc[ my_list, my_list ].copy() axes = pd.plotting.scatter_matrix(df4, figsize=(15, 15), marker='o',hist_kwds={'bins': 20}, s=60, alpha=.8) corr = df4.co

我无法在y轴和x轴上旋转名称,使它们重叠。我做错了什么

yticks/xticks(旋转=90)也不会调整名称以防止它们重叠

name = 'Anne Frank Diary'
df4 = df.loc[ my_list, my_list ].copy()
axes = pd.plotting.scatter_matrix(df4, figsize=(15, 15), marker='o',hist_kwds={'bins': 20}, s=60, alpha=.8)
corr = df4.corr().values 
for i, j in zip(*plt.np.triu_indices_from(axes, k=1)):
    axes[i, j].annotate("%.3f" %corr[i,j], (0.8, 0.8), xycoords='axes fraction', ha='left', va='center',rotation=90)
sst="%s \n Scatter Matrix of Centrality Indices \n (displaying Pearson correlation coefficients)" %name
plt.suptitle(sst,fontsize=20);

更新: my_list=['Kugler', “玛歌”, “安妮”, “Pirn”, “克莱曼”, “德语”, “荷兰语”, “杜塞尔”, "附件",, “彼得”, “基蒂”, "Bep",, “穆斯基”, “英国人”, “Miep”,
“van D.”]

提供一个代码,我们可以运行该代码来测试问题,更新后的链接df现在可用,以及我的列表来过滤df。现在应该可以测试了。很抱歉。
n = len(G.nodes)

for x in range(n):
    for y in range(n):
        # to get the axis of subplots
        ax = axes[x, y]
        # to make x axis name vertical  
        ax.xaxis.label.set_rotation(90)
        # to make y axis name horizontal 
        ax.yaxis.label.set_rotation(0)
        # to make sure y axis names are outside the plot area
        ax.yaxis.labelpad = 10
``