I am trying to plot a truncated Gaussian distribution (using scipy) with a mean of
0.5, and a standard distribution of
1.0. The distribution is truncated to be only in the interval
x = np.linspace(0,1,100) dist=truncnorm(a=0,b=1,loc=0.5, scale = 1.0) plt.plot(x, dist.pdf(x), 'k-', lw=2, label='normalised truncated Gaussian')
However I get this instead:
x=0.5 seems normal but below that you get a sudden dip to zero. However the distribution should only be zero outside of
(0,1). What is going on and how do I fix it?