[Python] How to plot x-axis in scientific notation but only mutiples of 3?

Discussão em 'Python' iniciado por Stack, Julho 31, 2025.

  1. Stack

    Stack Membro Participativo

    How can i make the plot to show in the x-axis scientific notation but only in multiples of 3? that is: 1e-3, 1e-6, 1e-9, etc.

    The following example generates a scale in 1e-4, which is not multiple of 3.

    import numpy as np
    import matplotlib.pyplot as plt

    # time
    T = 30e-6
    N = 10
    time = np.linspace(0, N*T, num=N)

    plt.plot(time,np.sin(time))
    ax = plt.gca()
    ax.ticklabel_format(style='sci',axis='both',scilimits=(0,0))

    Continue reading...

Compartilhe esta Página