Rotate axis text in python matplotlib

前端 未结 13 1059
暗喜
暗喜 2020-11-22 14:50

I can\'t figure out how to rotate the text on the X Axis. Its a time stamp, so as the number of samples increase, they get closer and closer until they overlap. I\'d like

13条回答
  •  余生分开走
    2020-11-22 15:31

    The simplest solution is to use:

    plt.xticks(rotation=XX)
    

    but also

    # Tweak spacing to prevent clipping of tick-labels
    plt.subplots_adjust(bottom=X.XX)
    

    e.g for dates I used rotation=45 and bottom=0.20 but you can do some test for your data

提交回复
热议问题