Fixed the y-scaling problem

This commit is contained in:
2026-02-27 16:34:08 +01:00
parent 2281ab1b27
commit 882b590865

View File

@@ -20,6 +20,7 @@ fig, ax = plt.subplots()
textstr = '\n'.join((
r'$n=%d$' % (len(data)),
r'$\mu=%.2f$' % (mean, ),
r'$\sigma=%.2f$' % (stddev, ),
r'$P=%.2f$' % (prob, ),
r'$I=%.2f$ bits' % (info, )))
# these are matplotlib.patch.Patch properties
@@ -30,7 +31,7 @@ ax.text(0.05, 0.95, textstr, transform=ax.transAxes, fontsize=14,
verticalalignment='top', bbox=props)
x = np.linspace(mean-3*stddev, mean+3*stddev, 500)
y = norm.pdf(x, mean, stddev)
y = norm.pdf(x, loc=mean, scale=stddev) * stddev#rescale back to unity area
plt.axvline(x=mean, color="green", linestyle="dashed", label="mean")
plt.axvline(lowerbound, color="red")
plt.axvline(upperbound, color="red")