我有三个子图共享x轴。我需要子图之间的 hspace 为 0.0,但随后子图的 y 标签重叠。
子图重叠的 ylabel
有没有办法将每个子图的极端 y 标签向下或向上移动一点(就像我在右侧的 mspaint 中手动所做的那样)?
皮奥特
有一个专用的股票代码格式化器类正是为此目的。
http://matplotlib.org/api/ticker_api.html#matplotlib.ticker.MaxNLocator
from matplotlib.ticker import MaxNLocator
ax2.yaxis.set_major_locator(MaxNLocator(prune='upper')) #remove highest label so it wont overlapp with stacked plot.
编辑:实际上,这不会移动它们,只需删除重叠的刻度即可。