Python pyplot x-axis label rotation
setp
looks to be the way to go with pyplot (inspiration from this answer). This works for me:
import matplotlib.pyplot as plt
import seaborn as sns; sns.set()
import numpy as np; np.random.seed(0)
data = np.random.rand(10, 12)
ax = sns.heatmap(data)
ax.xaxis.tick_top()
locs, labels = plt.xticks()
plt.setp(labels, rotation=90)
plt.show()
Obviously I don't have your data, hence the numpy random data, but otherwise the effect is as required:
网友评论