当前位置: 动力学知识库 > 问答 > 编程问答 >

python - Increasing the space for x axis labels in Matplotlib

问题描述:

I'm plotting, but find that I need to increase the area underneath chart such that I can plot the labels vertically but in a font size that is not so tiny. At the moment, I have:

plt.figure(count_fig) fig, ax = plt.subplots()

rects1 = ax.bar(ind, ratio_lst, width, color='r', linewidth=1, alpha=0.8, log=1)

ax.set_ylabel('')

ax.set_title('')

ax.set_xticks(ind_width)

ax.set_xticklabels(labels_lst, rotation='vertical', fontsize=6)

At the moment it works, but the labels often run-off the edge of the plot.

网友答案:

subplots_adjust will do it. You can play with the bottom keyword to get a good placement of the bottom of the plot.

fig.subplots_adjust(bottom=0.2)
分享给朋友:
您可能感兴趣的文章:
随机阅读: