Rotate axis text in python matplotlib

前端 未结 13 1117
暗喜
暗喜 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:39

    I came up with a similar example. Again, the rotation keyword is.. well, it's key.

    from pylab import *
    fig = figure()
    ax = fig.add_subplot(111)
    ax.bar( [0,1,2], [1,3,5] )
    ax.set_xticks( [ 0.5, 1.5, 2.5 ] )
    ax.set_xticklabels( ['tom','dick','harry'], rotation=45 ) ;
    

提交回复
热议问题