python + matplotlib: barh plot show incomplete YTick labels - how to dynamically move the plot area to the right to fit the given YTickLabels?

后端 未结 2 1410
野的像风
野的像风 2021-01-13 14:00

I\'m using matplotlib to plot a barh plot to a file. Unfortunate, the YTickLaels are a bit too long and the plot area won\'t move to the right auto

2条回答
  •  感动是毒
    2021-01-13 14:48

    According to matplotlib mailing list, there is no automatic way of doing this. However, you can manually ajdust subplot padding by using figure.subplots_adjust method. Placing fig.subplots_adjust(left = 0.4) after ax = fig.add_subplot(111) in your code yields following result:

    enter image description here

提交回复
热议问题