code: def plot_ellipses(ax, weights, means, covars):
      for n in range(means.shape[0]):
          eig_vals, eig_vecs = np.linalg.eigh(covars[n])
          unit_eig_vec = eig_vecs[0] / np.linalg.norm(eig_vecs[0])
          angle = np.arctan2(unit_eig_vec[1], unit_eig_vec[0])
          # Ellipse needs degrees
          angle = 180 * angle / np.pi
          # eigenvector normalization
          eig_vals = 2 * np.sqrt(2) * np.sqrt(eig_vals)
          ell = mpl.patches.Ellipse(
              means[n],
              eig_vals[0],
              eig_vals[1],
              angle=180 + angle,
              edgecolor="black",
          )
          ell.set_clip_box(ax.bbox)
          ell.set_alpha(weights[n])
          ell.set_facecolor("#56B4E9")
          ax.add_artist(ell)
  
imports: import matplotlib
  import matplotlib.gridspec
  import matplotlib.pyplot
  import numpy
  from sklearn.mixture import BayesianGaussianMixture
label_desc: Use image node_id 1 for calling a global function with example usage: plot_ellipses(ax, weights, means, covars) without return types