Matplotlib-向下移动X轴标签,但不向下移动X轴刻度
我正在使用Matplotlib绘制直方图. 使用上一个问题的提示: Matplotlib-为每个垃圾箱贴标签, 我或多或少地努力了.
I'm using Matplotlib to plot a histogram. Using tips from my previous question: Matplotlib - label each bin, I've more or less go the kinks worked out.
最后一个问题-以前-在x轴刻度线(0.00、0.04、0.08、0.12等)下方显示了x轴标签(时间(以毫秒为单位)")
There's one final issue - previously - the x-axis label ("Time (in milliseconds)") was being rendered underneath the x-axis tickmarks (0.00, 0.04, 0.08, 0.12 etc.)
根据乔·金斯顿(Joe Kingston)的建议(请参阅上面的问题),我尝试使用:
Using the advice from Joe Kingston (see question above), I tried using:
ax.tick_params(axis='x', pad=30)
但是,这会同时移动x轴刻度线(0.00、0.04、0.08、0.12等)以及x轴标签(时间(以毫秒为单位)"):
However, this moves both the x-axis tickmarks (0.00, 0.04, 0.08, 0.12 etc.), as well as the x-axis label ("Time (in milliseconds)"):
有什么办法只能将x轴标签移动到三行图形的下面吗?
Is there any way to move only the x-axis label to underneath the three rows of figures?
Nb:您可能需要直接打开下面的PNG-右键单击图像,然后单击查看图像"(以FF键)或在新标签页中打开图像"(Chrome).由SO完成的图像调整大小使它们几乎不可读
使用labelpad参数:
use labelpad parameter:
pl.xlabel("...", labelpad=20)
或在之后设置:
ax.xaxis.labelpad = 20