class_docstr: Standard GMM.
  
  this class contains the following members
  k (int): the number of components in the mixture
  dim (int): is the dimension of the data
  prec_type = 'full' (string) is the parameterization
            of the precisions/covariance matrices:
            either 'full' or 'diagonal'.
  means: array of shape (k,dim):
        all the means (mean parameters) of the components
  precisions: array of shape (k,dim,dim):
             the precisions (inverse covariance matrix) of the components
  weights: array of shape(k): weights of the mixture
  
  fixme
  -----
  no copy method
class_docstr_tok: ["Standard","GMM",".","this","class","contains","the","following","members","k","(","int",")",":","the","number","of","components","in","the","mixture","dim","(","int",")",":","is","the","dimension","of","the","data","prec_type","=","'full","'","(","string",")","is","the","parameterization","of","the","precisions\/covariance","matrices",":","either","'full","'","or","'diagonal","'",".","means",":","array","of","shape","(","k",",","dim",")",":","all","the","means","(","mean","parameters",")","of","the","components","precisions",":","array","of","shape","(","k",",","dim",",","dim",")",":","the","precisions","(","inverse","covariance","matrix",")","of","the","components","weights",":","array","of","shape","(","k",")",":","weights","of","the","mixture","fixme","--","--","-","no","copy","method"]
docstr: Function to plot a GMM -- Currently, works only in 1D
  
  Parameters
  ----------
  x: array of shape(n_samples, dim)
     the data under study
  gd: GridDescriptor instance
  density: array os shape(prod(gd.n_bins))
           density of the model one the discrete grid implied by gd
           by default, this is recomputed
  mpaxes: axes handle to make the figure, optional,
          if None, a new figure is created
docstr_tok: ["Function","to","plot","a","GMM","--","Currently",",","works","only","in","1D","Parameters","--","--","--","--","--","x",":","array","of","shape","(","n_samples",",","dim",")","the","data","under","study","gd",":","GridDescriptor","instance","density",":","array","os","shape","(","prod","(","gd.n_bins",")",")","density","of","the","model","one","the","discrete","grid","implied","by","gd","by","default",",","this","is","recomputed","mpaxes",":","axes","handle","to","make","the","figure",",","optional",",","if","None",",","a","new","figure","is","created"]
code: def show_components(self, x, gd, density=None, mpaxes=None):
      """Function to plot a GMM -- Currently, works only in 1D
  
      Parameters
      ----------
      x: array of shape(n_samples, dim)
         the data under study
      gd: GridDescriptor instance
      density: array os shape(prod(gd.n_bins))
               density of the model one the discrete grid implied by gd
               by default, this is recomputed
      mpaxes: axes handle to make the figure, optional,
              if None, a new figure is created
      """
      import matplotlib.pyplot as plt
  
      if density is None:
          density = self.mixture_likelihood(gd.make_grid())
  
      if gd.dim > 1:
          raise NotImplementedError("only implemented in 1D")
  
      step = 3.5 * np.std(x) / np.exp(np.log(np.size(x)) / 3)
      bins = max(10, int((x.max() - x.min()) / step))
      xmin = 1.1 * x.min() - 0.1 * x.max()
      xmax = 1.1 * x.max() - 0.1 * x.min()
      h, c = np.histogram(x, bins, [xmin, xmax], normed=True)
  
      # Make code robust to new and old behavior of np.histogram
      c = c[: len(h)]
      offset = (xmax - xmin) / (2 * bins)
      c += offset / 2
      grid = gd.make_grid()
  
      if mpaxes is None:
          plt.figure()
          ax = plt.axes()
      else:
          ax = mpaxes
      ax.plot(c + offset, h, linewidth=2)
  
      for k in range(self.k):
          ax.plot(grid, density[:, k], linewidth=2)
      ax.set_title(
          "Fit of the density with a mixture of Gaussians", fontsize=12
      )
  
      legend = ["data"]
      for k in range(self.k):
          legend.append("component %d" % (k + 1))
      l = ax.legend(tuple(legend))
      for t in l.get_texts():
          t.set_fontsize(12)
      ax.set_xticklabels(ax.get_xticks(), fontsize=12)
      ax.set_yticklabels(ax.get_yticks(), fontsize=12)
  
imports: import numpy
  from scipy.linalg import eigvalsh
label_desc: Use image node_id 23 for calling the GMM obj's underlying member method code with example usage: obj.show_components(x, gd, density, mpaxes) without return types