code: def _pca_weights(
          weights,
          pc,
          threshold=None,
          label_threshold=None,
          label_weights=None,
          optimize_label_iter=OPTIMIZE_LABEL_ITER_DEFAULT,
          **kwargs
      ):
      
      fig = plt.figure(figsize=(8, 8))
      ax = fig.add_subplot(1,1,1)
      ax.plot(weights.iloc[:, pc].values)
      ylim = np.max( np.abs( weights.values ) ) * 1.1
      ax.set_ylim( -ylim, +ylim  )
      ax.set_xlim(0, weights.shape[0])
      ax.set_aspect(1./ax.get_data_ratio())
      
      wts = weights.iloc[:, pc]
      texts = []
  
      if threshold:
          if label_threshold is None:
              label_threshold = threshold
  
          if label_weights:
  
              FILTER_UP = wts.values >= label_threshold
              FILTER_DOWN = wts.values <= -label_threshold
              FILTER = FILTER_UP | FILTER_DOWN
  
              wti = np.arange(0, weights.shape[0])
              wti = wti[FILTER]
  
              idxs = get_index_list( wts.index.names, label_weights )
              for x in wti:
                  y = wts.iloc[x]
                  t = ax.text(x, y, build_combined_label( wts.index.values[x], idxs), bbox=dict(boxstyle='round,pad=0.3', fc='#ffffff', ec='none', alpha=0.4))
                  texts.append(t)
  
          if texts and optimize_label_iter:
              adjust_text(
                  texts,
                  lim=optimize_label_iter,
                  arrowprops=dict(arrowstyle='->', color='red')
              )
  
          ax.axhline(threshold, 0, 1)
          ax.axhline(-threshold, 0, 1)
  
      ax.set_ylabel("Weights on Principal Component %d" % (pc+1), fontsize=16)
      fig.tight_layout()
      return ax
docs: :param weights:
      :param pc:
      :param threshold:
      :param label_threshold:
      :param label_weights:
      :param kwargs:
      :return: