[Python] Strange plt.pcolormesh Behavior: Only One Line Visible

Discussão em 'Python' iniciado por Stack, Janeiro 27, 2025.

  1. Stack

    Stack Membro Participativo

    While doing exercises with different spectrograms, I discovered some behavior in pcolormesh that I can't explain. Could you please explain what I am doing wrong or what I didn't understand?

    For example, the code below shows only one line (the upper one).

    import matplotlib.pyplot as plt
    import numpy as np

    t = np.linspace(0, 5, 301) # Ajouter un point pour les bords
    f = np.linspace(-1000, 1000, 501) # Ajouter un point pour les bords

    valeurs = np.zeros((500, 300))



    valeurs[100, :] = 10
    valeurs[400, :] = 10

    plt.pcolormesh(t,f,valeurs)
    #plt.pcolormesh(valeurs) #Give the same result except on axis marks.
    plt.show()

    Continue reading...

Compartilhe esta Página