[Python] Rotate minor ticks in matplotlib

Discussão em 'Python' iniciado por Stack, Maio 3, 2025.

  1. Stack

    Stack Membro Participativo

    I am plotting the following chart :

    [​IMG]

    with the following code:

    fig, ax = plt.subplots(figsize=(20, 3))
    mpf.candlestick_ohlc(ax,quotes, width=0.01)
    ax.xaxis_date()
    ax.xaxis.set_minor_locator(mpl.dates.HourLocator(interval=4) )
    ax.xaxis.set_minor_formatter(mpl.dates.DateFormatter('%H:%M'))
    plt.xticks(rotation = 90)

    plt.grid(True)
    plt.show()


    I would like to also rotate the minor ticks: How would i do that?

    Subsidiary question is there a way to rotate both major and minor tick with a single command?

    Continue reading...

Compartilhe esta Página