Reputation: 29
I'm trying to rotate my xticklabels in a seaborn cluster map and I've tried solutions from other posts but I can never get it to work. Here's what I've tried so far:
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'
and this
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'
Upvotes: 1
Views: 676
Reputation: 2223
hm=sns.clustermap(data=pltdf.iloc()[:,1:14],
standard_scale=0,
yticklabels=pltdf['uniprot_sym'])
plt.setp(hm.ax_heatmap.get_xticklabels(), rotation=30)
Upvotes: 3