From 882b5908659acaefb683818f9da4271860f8f0c6 Mon Sep 17 00:00:00 2001 From: Joseph Timothy Foley Date: Fri, 27 Feb 2026 16:34:08 +0100 Subject: [PATCH] Fixed the y-scaling problem --- normdist.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/normdist.py b/normdist.py index 00cb33b..b7681bc 100644 --- a/normdist.py +++ b/normdist.py @@ -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")