def plot_normal_mix(pis, mus, sigmas, ax, label='', comp=True):
 x = np.linspace((-10.5), 10.5, 250)
 final = np.zeros_like(x)
 for (i, (weight_mix, mu_mix, sigma_mix)) in enumerate(zip(pis, mus, sigmas)):
  temp = (stats.norm.pdf(x, mu_mix, sigma_mix) * weight_mix)
  final = (final + temp)
  if comp:
   ax.plot(x, temp, label=('Normal ' + str(i)))
 ax.plot(x, final, label=('Mixture of Normals ' + label))
 ax.legend(fontsize=13)

def plot_normal_mix ( pis , mus , sigmas , ax , label = '' , comp = True ) : x = np . linspace ( ( - 10.5 ) , 10.5 , 250 ) final = np . zeros_like ( x ) for ( i , ( weight_mix , mu_mix , sigma_mix ) ) in enumerate ( zip ( pis , mus , sigmas ) ) : temp = ( stats . norm . pdf ( x , mu_mix , sigma_mix ) * weight_mix ) final = ( final + temp ) if comp : ax . plot ( x , temp , label = ( 'Normal ' + str ( i ) ) ) ax . plot ( x , final , label = ( 'Mixture of Normals ' + label ) ) ax . legend ( fontsize = 13 )
plots the mixture of normal models to axis=ax comp=true plots all components of mixture model .