Rotate minor ticks in matplotlib

后端 未结 3 919
遇见更好的自我
遇见更好的自我 2020-12-11 02:52

I am plotting the following chart :

with the following code:

fig, ax = plt.subplots(figsize=(20, 3))
mpf.candlestick_ohlc(ax,quotes, width=0         


        
3条回答
  •  甜味超标
    2020-12-11 03:36

    By exploring a little, I discovered that ax.get_xminorticklabels() is a list with a text class element.

    >>> print(type(ax.get_xminorticklabels()[0])) 
    
    

    And text can be rotated!

    >>> for text in ax.get_xminorticklabels():
    >>>     text.set_rotation(90)
    

    You only have to be careful that they do not overlap.

提交回复
热议问题