【发布时间】:2019-08-13 07:56:36
【问题描述】:
我有很长的情节刻度标签,不幸的是我无法缩短。因此,我正在寻找将标签拆分为多行(换行文本)的代码。我尝试了文本换行,但它导致我的代码出错。
将刻度标签放在rotation=0 会使刻度标签相互重叠并变得不可读。
我也尝试使用rotation=90,但刻度标签反而溢出到我的图表空间中。
plt.title(param)
plt.ylabel('Measurement')
plt.xticks(x_axis, labels, rotation = 10, fontsize=8, horizontalalignment="center")
plt.tick_params(axis='x', pad=6)
lgd = ax.legend(loc = 'upper left', bbox_to_anchor=(1,1))
【问题讨论】:
-
我试过了。但它没有用。代码不会执行。
标签: python matplotlib