Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import matplotlib.pyplot as plt
- import numpy as np
- import scipy.stats as st
- mu, sigma = 0, 1.0 # media y desvio estandar
- datos = np.random.normal(mu, sigma, 10000) #creando muestra de datos
- x=np.linspace(-4,4,num=1000)
- y=st.norm.pdf(x,0,1)
- plt.plot(x,y,'r')
- # histograma de distribución normal.
- plt.hist(datos, 30,color='c',histtype='bar',cumulative=False,edgecolor='black', linewidth=0.7,density=True,label="Datos")
- plt.plot(x,y,'r--',label="PDF distribucion Normal ")
- plt.ylim(0,0.5)
- plt.ylabel('frequencia')
- plt.xlabel('valores')
- plt.title('Histograma - Variable aleatoria normal')
- plt.legend(loc="upper right")
- plt.show()
- # -*- coding: utf-8 -*-
- from matplotlib import rcParams
- import matplotlib.pyplot as plt
- import numpy as np
- import scipy.stats as st
- rcParams['font.family'] = 'sans-serif'
- rcParams['font.sans-serif'] = ['DejaVu Sans', 'Tahoma']
- mu, sigma = 0, 1.0 # media y desvio estandar
- datos = np.random.normal(mu, sigma, 10000) #creando muestra de datos
- x = np.linspace(-4, 4, num=1000)
- y = st.norm.pdf(x, 0, 1)
- plt.plot(x, y, 'r--', label=(u"μ={}, σ²={}".format(mu, sigma)))
- plt.legend(loc="upper right")
- plt.show()
- import matplotlib.pyplot as plt
- import numpy as np
- import scipy.stats as st
- mu, sigma = 0, 1.0 # media y desvio estandar
- datos = np.random.normal(mu, sigma, 10000) #creando muestra de datos
- x = np.linspace(-4, 4, num=1000)
- y = st.norm.pdf(x, 0, 1)
- plt.plot(x, y, 'r--', label=("$\mu$={}, $\sigma^2$={}".format(mu, sigma)))
- plt.legend(loc="upper right")
- plt.show()
Add Comment
Please, Sign In to add comment