Rotate minor ticks in matplotlib

后端 未结 3 920
遇见更好的自我
遇见更好的自我 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:34

    While dealing with the problem myself, I discovered that you can also easily accomplish this with a single statement using the tick_params:

    ax.tick_params(axis="x", which="both", rotation=45)
    

    This will rotate labels on your x axis, and the which option allows you to choose between minor, major or both. In case you have multiple plots you will have to do this for every plot in the figure.

提交回复
热议问题