[Python] matplotlib: y axis format refuses to go scientific

Discussão em 'Python' iniciado por Stack, Outubro 24, 2024.

  1. Stack

    Stack Membro Participativo

    I attempted to change the format of the matplotlib plot axis labels to scientific using the Axes.ticklabel_format function described in (https://matplotlib.org/stable/api/_as_gen/matplotlib.axes.Axes.ticklabel_format.html). With the following toy code

    import numpy as np
    import matplotlib.pyplot as plt

    # Data...
    T = np.arange(0, 101, 0.01)

    R_e = 1.68799673810490
    R = np.sin(T) + R_e

    # Plotting figure
    fig, ax = plt.subplots(1, 1)
    ax.plot(T, R)

    # Attempting to set scientific format for both axes
    ax.ticklabel_format(axis = 'both', style = 'scientific', scilimits = (0, 0))

    # Save figure
    plt.savefig('Test.png', format = 'png')


    I expected it to change both the x and y axis. It only changes the x axis. [​IMG] Any help would be appreciated!

    Continue reading...

Compartilhe esta Página