I am trying to use a truncated normal distribution with scipy
in Python3. I want to do something simple: plot the pdf of a truncated normal centered at 0.5 and ranging from 0 to 1. I have the following code line
from scipy import truncnorm
import matplotlib.pyplot as plt
plt.plot([truncnorm.pdf(p,0,1, loc=0.5) for p in np.arange(0,1.1,0.1)])
However, this does not give the nice bell-shaped probability distribution function I would expect. Rather, it equals 0 before 0.5, and I cannot figure out why. Any advice on this?
Here's the procedure to follow according to the documentation of
truncnorm
.