Skip to content

Instantly share code, notes, and snippets.

@SaraM92
Created September 29, 2020 20:12
Show Gist options
  • Save SaraM92/42f7b70198d2784a089eaa39ff34dfa0 to your computer and use it in GitHub Desktop.
Save SaraM92/42f7b70198d2784a089eaa39ff34dfa0 to your computer and use it in GitHub Desktop.
# for inline plots in jupyter
%matplotlib inline
# import matplotlib
import matplotlib.pyplot as plt
# import seaborn
import seaborn as sns
# settings for seaborn plotting style
sns.set(color_codes=True)
# settings for seaborn plot sizes
sns.set(rc={'figure.figsize':(5,5)})
# import uniform distribution
from scipy.stats import uniform
# random numbers from uniform distribution
n = 10000
start = 10
width = 20
data_uniform = uniform.rvs(size=n, loc = start, scale=width)
ax = sns.distplot(data_uniform,
bins=100,
kde=True,
color='skyblue',
hist_kws={"linewidth": 15,'alpha':1})
ax.set(xlabel='Uniform Distribution ', ylabel='Frequency')
[Text(0,0.5,u'Frequency'), Text(0.5,0,u'Uniform Distribution ')]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment