[Python] Why matplotlib is not graphing correctly?

Discussão em 'Python' iniciado por Stack, Março 11, 2025.

  1. Stack

    Stack Membro Participativo

    I have a simple code, to graph the data of the first and second column of a .txt file . However, the graph made by matplotlib (python) is incorrect if I compare it with the one made in excel. Why is this?

    Material_A = "C:/Users/Admin/Desktop/2025/Si_refractive index.txt"

    Thin_film_Mat_A = np.loadtxt(Material_A,delimiter='\t',skiprows=1)

    a_min , a_max = VisualizationRange(lamb_min , lamb_max)
    lamb = Thin_film_Mat_A[a_min:a_max +1,0]


    #========================== #==========================

    # Complex Refractive Index
    # Silicon
    NA = Thin_film_Mat_A[a_min:a_max +1,1]
    NA_normalized = ( NA - min(NA) ) / ( max(NA) - min(NA) )

    # Graphic
    plt.plot(lamb,NA_normalized)
    plt.xlabel("Longitud de onda (nm)")
    plt.ylabel("NA (u.a.)")
    plt.grid(True)
    plt.show()


    [​IMG]

    Continue reading...

Compartilhe esta Página