SoFunction
Updated on 2024-11-13

Example of python plotting a normal curve

import numpy as np
import  as plt
import math
# Python implementation of the normal distribution
# Plotting normally distributed probability density functions
u = 0  # Mean μ
u01 = -2
sig = (0.2) # Standard deviation δ
sig01 = (1)
sig02 = (5)
sig_u01 = (0.5)
x = (u - 3*sig, u + 3*sig, 50)
x_01 = (u - 6 * sig, u + 6 * sig, 50)
x_02 = (u - 10 * sig, u + 10 * sig, 50)
x_u01 = (u - 10 * sig, u + 1 * sig, 50)
y_sig = (-(x - u) ** 2 /(2* sig **2))/((2*)*sig)
y_sig01 = (-(x_01 - u) ** 2 /(2* sig01 **2))/((2*)*sig01)
y_sig02 = (-(x_02 - u) ** 2 / (2 * sig02 ** 2)) / ((2 * ) * sig02)
y_sig_u01 = (-(x_u01 - u01) ** 2 / (2 * sig_u01 ** 2)) / ((2 * ) * sig_u01)
(x, y_sig, "r-", linewidth=2)
(x_01, y_sig01, "g-", linewidth=2)
(x_02, y_sig02, "b-", linewidth=2)
(x_u01, y_sig_u01, "m-", linewidth=2)
# (x, y, 'r-', x, y, 'go', linewidth=2,markersize=8)
(True)
()

Effect:

Above is the details of python draw normal curve example, more information about python draw normal curve please pay attention to my other related articles!