【发布时间】:2021-04-27 07:52:21
【问题描述】:
我正在尝试在 seaborn 集群地图中旋转我的 xticklabels,并且我已经尝试了其他帖子的解决方案,但我永远无法让它发挥作用。到目前为止,这是我尝试过的:
hm=sns.clustermap(data=pltdf.iloc()[:,1:14],
standard_scale=0,
yticklabels=pltdf['uniprot_sym'])
hm.set_xticklabels(rotation=30)
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-87-05bb29d461e2> in <module>
2 standard_scale=0,
3 yticklabels=pltdf['uniprot_sym'])
----> 4 hm.set_xticklabels(rotation=30)
5
AttributeError: 'ClusterGrid' object has no attribute 'set_xticklabels'
还有这个
hm=sns.clustermap(data=pltdf.iloc()[:,1:14],
standard_scale=0,
yticklabels=pltdf['uniprot_sym'])
for ax in hm.axes.flat:
ax.tick_params("x", labelrotation=45)
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-86-d96774d92376> in <module>
2 standard_scale=0,
3 yticklabels=pltdf['uniprot_sym'])
----> 4 for ax in hm.axes.flat:
5 ax.tick_params("x", labelrotation=45)
AttributeError: 'ClusterGrid' object has no attribute 'axes'
【问题讨论】:
-
我使用的是 0.11.0,并更新到 0.11.1,但还是一样。不过,下面的答案确实有效。