Matplotlib: Move x-axis tick labels one position to left

前端 未结 2 602
慢半拍i
慢半拍i 2021-01-12 18:50

I am making a bar chart and I want to move the x-axis tick labels one position to left. Here is the code of the plot:

matplotlib.rcParams.update(matplotlib.r         


        
2条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-12 19:37

    See this question: How can I rotate xticklabels in matplotlib so that the spacing between each xticklabel is equal?

    There the solution is to align the labels to their right side:

    ax.set_xticklabels(xticklabels, rotation = 45, ha="right")
    

提交回复
热议问题