import
matplotlib.pyplot as plt
import
matplotlib.patches as mpatches
import
scipy.stats
import
numpy as np
x_min
=
0.0
x_max
=
50.0
fig
=
plt.figure(figsize
=
(
16
,
9
))
mean
=
12.0
std
=
3.0
x
=
np.linspace(x_min, x_max,
100
)
y
=
scipy.stats.norm.pdf(x,mean,std)
plt.plot(x,y, color
=
'red'
)
plt.fill_between(x, y, color
=
'#CE5D45'
, alpha
=
1.0
)
mean
=
18.0
std
=
6.0
x
=
np.linspace(x_min, x_max,
100
)
y
=
scipy.stats.norm.pdf(x,mean,std)
plt.plot(x,y, color
=
'green'
)
plt.fill_between(x, y, color
=
'#5DC83F'
, alpha
=
1.0
)
pop_a
=
mpatches.Patch(color
=
'#5DC83F'
, label
=
'Population Dataset 1'
)
pop_b
=
mpatches.Patch(color
=
'#CE5D45'
, label
=
'Population Dataset 2'
)
plt.legend(handles
=
[pop_a,pop_b])
plt.grid()
plt.xlim(x_min,x_max)
plt.ylim(
0
,
0.25
)
plt.title(
'simple legend example'
,fontsize
=
12
)
plt.xlabel('')
plt.ylabel(
'Probability Distribution'
)
plt.show()