1

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' 

Both output thisenter image description here

1
  • I was using 0.11.0, and updated to 0.11.1, but still got the same. The answer below did work though. Commented Apr 27, 2021 at 22:33

1 Answer 1

3
hm=sns.clustermap(data=pltdf.iloc()[:,1:14], standard_scale=0, yticklabels=pltdf['uniprot_sym']) plt.setp(hm.ax_heatmap.get_xticklabels(), rotation=30) 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.