How to scale X of plot in Python?

168 Views Asked by At

I have the following code that builds the empirical function according to data stored in Z_score_list.

Z_score_list.sort()
    edf = []
    step = 1 / len(Z_score_list)
    for i in range(len(Z_score_list)):
        edf.append(step * i)
    edf = np.array(edf)
    fig, ax = plt.subplots()
    ax.plot(Z_score_list, edf,
            'b--', lw=3, alpha=0.6, label='Эмпирическая')
    plt.show()

As a result I have this:

enter image description here

There isn't enough space for X axis. So it breaks the plot and continues it from the start of X axis to its end. How can I scale this graphic for the one continuous line that will be independent from Z_score_list size?

1

There are 1 best solutions below

0
On

The problem wasn't in plot function itself, there were NaN values in Z_score_list and every occurance of it starts sort again from the index NaN was occured. Removing these values made it all ok.