在x轴上,我想显示数字(没有旋转)与旋转的名称以下的每一个数字。我有以下内容,但想分别旋转名称‘1’,‘2’和‘3’。
plt.xticks([1,2,3], ['1\n one', '2\n two', '3\n three'], rotation=45]发布于 2014-10-31 13:44:13
你可以在相同的位置放置大号和小号。下面是一个最小的例子:
import pylab as pl
pl.clf()
ax = pl.gca()
ax.set_xticks([1, 2, 3])
ax.set_xticks([1, 2, 3], minor=True)
ax.set_xticklabels(['one', 'two', 'three'], minor=True)
pl.setp(ax.xaxis.get_minorticklabels(), rotation=-45)
for t in ax.get_xticklabels(minor=True):
t.set_y(-0.03)

(this answer给出了一些启示。)
https://stackoverflow.com/questions/26674711
复制相似问题