title: How to add already created figures to a subplot figure
body: <p>I created this function that generates the ROC_AUC, then I returned the figure created to a variable.</p>
  <pre><code>from sklearn.metrics import roc_curve, auc
  from sklearn.preprocessing import label_binarize
  import matplotlib.pyplot as plt
  
  def plot_multiclass_roc(clf, X_test, y_test, n_classes, figsize=(17, 6)):
      y_score = clf.decision_function(X_test)
  
      # structures
      fpr = dict()
      tpr = dict()
      roc_auc = dict()
  
      # calculate dummies once
      y_test_dummies = pd.get_dummies(y_test, drop_first=False).values
      for i in range(n_classes):
          fpr[i], tpr[i], _ = roc_curve(y_test_dummies[:, i], y_score[:, i])
          roc_auc[i] = auc(fpr[i], tpr[i])
  
      # roc for each class
      fig, ax = plt.subplots(figsize=figsize)
      ax.plot([0, 1], [0, 1], 'k--')
      ax.set_xlim([0.0, 1.0])
      ax.set_ylim([0.0, 1.05])
      ax.set_xlabel('False Positive Rate')
      ax.set_ylabel('True Positive Rate')
      ax.set_title('Receiver operating characteristic for Optimized SVC model')
      for i in range(n_classes):
          ax.plot(fpr[i], tpr[i], label='ROC curve (area = %0.2f) for label %i' % (roc_auc[i], i+1))
      ax.legend(loc=&quot;best&quot;)
      ax.grid(alpha=.4)
      sns.despine()
      plt.show()
      return fig
  
  svc_model_optimized_roc_auc_curve = plot_multiclass_roc(svc_model_optimized, X_test, y_test, n_classes=3, figsize=(16, 10))
  </code></pre>
  <p>The resulting figure would look like somethin below:
  <a href="https://i.stack.imgur.com/x4KcP.png" rel="nofollow noreferrer">ROC curve for SVC model</a></p>
  <p>I created 5 different ROC curves for 5 different models using the same function but reurning their figures to seperate variables.</p>
  <p>Then I created a subplot figure that I thought would display all of them. The code is:</p>
  <p>import matplotlib.pyplot as plt
  %matplotlib inline</p>
  <pre><code>figs, ax = plt.subplots(nrows = 3,
                         ncols = 2,
                         figsize= (20, 20)
                         )
  
  ax[0,0] = logmodel_roc_auc_curve
  ax[0,1] = RandomForestModel_optimized_roc_auc_cruve
  ax[1,0] = decisiontree_model_optimized_roc_auc_curve
  ax[1,1] = best_clf_knn_roc_auc_curve
  ax[2,0] = svc_model_optimized_roc_auc_curve
  </code></pre>
  <p>But the resulting figure produced is this:
  <a href="https://i.stack.imgur.com/PrbFn.png" rel="nofollow noreferrer">empty subplots</a></p>
  <p>There was a similar problem to this <a href="https://stackoverflow.com/questions/65618035/adding-a-figure-created-in-a-function-to-another-figures-subplot">here</a>
  but it was solved by executing the functions again. But I would like to find a way if possible to just simply &quot;paste&quot; the figures I already have into the subplot.</p>