Skip to content

Instantly share code, notes, and snippets.

@jdavidrcamacho
Created April 6, 2020 15:26
Show Gist options
  • Save jdavidrcamacho/3373f8100ef7b4c0a3b0349db1c57cc9 to your computer and use it in GitHub Desktop.
Save jdavidrcamacho/3373f8100ef7b4c0a3b0349db1c57cc9 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import matplotlib.pylab as plt
from scipy import stats
myclip_a, myclip_b = -2, 2
my_mean, my_std = 0, 0.5
a, b = (myclip_a - my_mean) / my_std, (myclip_b - my_mean) / my_std
plt.hist(stats.norm(0,0.5).rvs(10000), bins = 100)
plt.hist(stats.truncnorm(a, b, loc = my_mean, scale = my_std).rvs(10000), bins=100)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment