code: def pca_comp_plot(
      X,
      y=None,
      figsize=(10, 8),
      title="Principal Components Comparison",
      title_font_size=14,
      show=True,
      **kwargs,
  ):
      """Function for comparing PCA analysis.
  
      Function compares across 2 and 3 dimensions and
      linear and rbf kernels.
  
      Parameters
      ----------
      X : array-like of shape = [n_samples, n_features]
          input matrix to be used for prediction.
  
      y : array-like of shape = [n_samples, ] or None (default = None)
          training labels to be used for color highlighting.
  
      figsize : tuple (default = (10, 8))
          Size of figure.
  
      title : str
          figure title if shown.
  
      title_font_size : int
          title font size.
  
      show : bool (default = True)
          whether to print figure :obj:`matplotlib.pyplot.show`.
  
      **kwargs : optional
          optional arguments to pass to :class:`mlens.visualization.pca_plot`.
  
      Returns
      -------
      ax :
          axis object.
  
      See Also
      --------
      :class:`mlens.visualization.pca_plot`
      """
      comp = ["linear", "rbf"]
      f = plt.figure(figsize=figsize)
  
      ax = []
      subplot_kwarg = {}
  
      for dim, frame in [(2, 221), (3, 223)]:
          if dim is 3:
              # Need to specify projection
              subplot_kwarg = {"projection": "3d"}
  
          for i, kernel in enumerate(comp):
              # Create subplot
              ax.append(f.add_subplot(frame + i, **subplot_kwarg))
  
              # Build figure
              ax[-1] = pca_plot(
                  X,
                  KernelPCA(dim, kernel),
                  y,
                  ax=ax[-1],
                  show=False,
                  **kwargs,
              )
  
              ax[-1].set_title("%s kernel, %i dims" % (kernel, dim))
  
              # Whiten background if dim is 3
              if dim is 3:
                  ax[-1].set_facecolor((1, 1, 1))
  
      if show:
          f.suptitle(title, fontsize=title_font_size)
          plt.show()
  
      return ax
  
imports: from __future__ import division, print_function
  import numpy
  import warnings
label_desc: Use image node_id 1 for calling a global function with example usage: pca_comp_plot(X, y, figsize, title, title_font_size, show) and returns: ax