Reputation: 31
I have three subplots sharing x-axis. I need hspace between subplots to be 0.0, but then y-labels of subplots overlap.
Is there any way to move extreme y-labels of each subplot a little bit downwards or upwards (as I did manually in mspaint, on the right)?
Piotr
Upvotes: 2
Views: 1217
Reputation: 13549
There is a dedicated ticker formater class exactly for this purpose.
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.
Edit: Actually this wont move them, just remove the overlapping ticks.
Upvotes: 2