[Python] Matplotlib: font size of the tick labels unit factor [duplicate]

Discussão em 'Python' iniciado por Stack, Fevereiro 5, 2025.

  1. Stack

    Stack Membro Participativo

    Below is an example plot, where the units are on the scale of 1e-5 and 1e-6, which causes matplotlib to factor this number and display it next to the axis.

    import numpy as np
    import matplotlib.pyplot as plt


    x = np.arange(100) * 1e-8
    y = np.random.normal(1e-5, 1e-6, size=100)

    plt.plot(x, y, '-')
    plt.tick_params(labelsize='xx-small')

    fig = plt.gcf()
    fig.set_size_inches(4, 3)
    fig.savefig('matplotlib_tick_unit_factor.png', bbox_inches='tight')


    Matplotlib plot with tick unit factors 1e-5 for Y axis and 1e-6 for the X axis:

    [​IMG]

    I would like to control the font size of this factor, but could not find it (not in tick_params and could not figure out if it is a Locator element).

    I could not find the name of this element in the anatomy of a figure.

    Continue reading...

Compartilhe esta Página