Rotate tick labels for seaborn barplot

前端 未结 5 1261
再見小時候
再見小時候 2021-01-30 20:20

I am trying to display a chart with rotated x-axis labels, but the chart is not displaying.

import seaborn as sns
%matplotlib inline

yellow=\'#FFB11E\'
by_schoo         


        
5条回答
  •  深忆病人
    2021-01-30 21:15

    If you come here to rotate the labels for a seaborn.heatmap, the following should work (based on @Aman's answer at Rotate label text in seaborn factorplot)

    pandas_frame = pd.DataFrame(data, index=names, columns=names)
    heatmap = seaborn.heatmap(pandas_frame)
    loc, labels = plt.xticks()
    heatmap.set_xticklabels(labels, rotation=45)
    heatmap.set_yticklabels(labels[::-1], rotation=45) # reversed order for y
    

提交回复
热议问题