Question: I am trying to plot the S-shape cumulative distribution function (cdf) curve of a normal distribution. However, I ended up with a uniform distribution. What am I doing wrong?

**Test Script**

```
import numpy as np
from numpy.random import default_rng
from scipy.stats import norm
import matplotlib.pyplot as plt

siz = 1000
rg = default_rng( 12345 )
a = rg.random(size=siz)
rg = default_rng( 12345 )
b = norm.rvs(size=siz, random_state=rg)
c = norm.cdf(b)

print( 'a = ', a)
print( 'b = ', b)
print( 'c = ', c)

fig, ax = plt.subplots(3, 1)
acount, abins, aignored = ax[0].hist( a, bins=20, histtype='bar', label='a', color='C0' )
bcount, bbins, bignored = ax[1].hist( b, bins=20, histtype='bar', label='b', color='C1' )
ccount, cbins, cignored = ax[2].hist( c, bins=20, histtype='bar', label='c', color='C2' )
print( 'acount, abins, aignored = ', acount, abins, aignored)
print( 'bcount, bbins, bignored = ', bcount, bbins, bignored)
print( 'ccount, cbins, cignored = ', ccount, cbins, cignored)
ax[0].legend()
ax[1].legend()
ax[2].legend()
plt.show()

```

[![enter image description here](https://i.stack.imgur.com/TShKL.png)](https://i.stack.imgur.com/TShKL.png)

Answer: 
Now I don't know your particular application. But I think the problem lies in that you are creating the values of the cdf for a number of normally distributed random numbers.
Below you can see a code example which plots the CDF of a standard normal from -3 to +3

```
import numpy as np
from scipy.stats import norm
import matplotlib.pyplot as plt

x = np.arange(-3, 3, 0.1)
c = norm.cdf(x)

plt.plot(x, c)
plt.show()

```

CDF of standard normal  

![1](https://i.stack.imgur.com/N7mHo.png)
You are plotting the wrong values.
when you do `b = norm.rvs(size=siz, random_state=rg)`, what you get is a 10 independently drawn random samples from standard normal distribution, i.e., `z` values

hence their histogram is what you see as bell shaped curve.

`norm.cdf` returns the `cfd` value at a given z value. If you want cdf's S curve, you can draw uniformly from -3 to 3 z values and get their cdf values at all points . then you plot the output probability values.

EDIT: The other answer gives code for this approach so I won't bother adding again.