Make the graphic distribution function



  • I wrote a code that generates a series of distributions: введите сюда описание изображения

    x_list_repeats = [70,75,75,75,85,95,105,125,125,125,130,130,135,135,135,135,145,145,150,150,150,150,160,165,180]
    hist, edges = np.histogram(x_list_repeats, bins=len(x_list_repeats))
    Y = hist.cumsum()
    for i in range(len(Y)):
        plt.plot([edges[i], edges[i + 1]], [Y[i], Y[i]], c="orange")
    

    But I can't make a schedule out of it.

    введите сюда описание изображения



  • You need to calculate the necessary coordinates. I've built a schedule for your code:

    import numpy as np
    import matplotlib.pyplot as plt
    

    x_list_repeats = [70,75,75,75,85,95,105,125,125,125,130,130,135,
    135,135,135,145,145,150,150,150,150,160,165,180]
    hist, edges = np.histogram(x_list_repeats, bins=len(x_list_repeats))
    Y = hist.cumsum()

    X_mid = []

    for i in range(len(Y)):
    plt.plot([edges[i], edges[i + 1]], [Y[i], Y[i]], c="orange")

    X_mid.append(sum([edges[i], edges[i + 1]]) / 2)
    

    plt.plot(x_list_repeats, Y, c = 'green')
    #x_list_repeats - список координат Х, Y - соответственно У

    c = 'green' - зеленым цветом

    plt.plot(X_mid, Y, c = 'red')

    введите сюда описание изображения



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2