code: def _makeplot(rs, ps, outDir, class_name, iou_type):
      import matplotlib.pyplot as plt
  
      export_path_list = []
  
      areaNames = ["allarea", "small", "medium", "large"]
      types = ["C75", "C50", "Loc", "Sim", "Oth", "BG", "FN"]
      for i in range(len(areaNames)):
          area_ps = ps[..., i, 0]
          figure_title = (
              iou_type + "-" + class_name + "-" + areaNames[i]
          )
          aps = []
          ps_curve = []
          for ps_ in area_ps:
              # calculate precision recal curves
              if ps_.ndim > 1:
                  ps_mean = np.zeros((ps_.shape[0],))
                  for ind, ps_threshold in enumerate(ps_):
                      ps_mean[ind] = ps_threshold[
                          ps_threshold > -1
                      ].mean()
                  ps_curve.append(ps_mean)
              else:
                  ps_curve.append(ps_)
              # calculate ap
              if len(ps_[ps_ > -1]):
                  ap = ps_[ps_ > -1].mean()
              else:
                  ap = np.array(0)
              aps.append(ap)
          ps_curve.insert(0, np.zeros(ps_curve[0].shape))
          fig = plt.figure()
          ax = plt.subplot(111)
          for k in range(len(types)):
              ax.plot(
                  rs, ps_curve[k + 1], color=[0, 0, 0], linewidth=0.5
              )
              ax.fill_between(
                  rs,
                  ps_curve[k],
                  ps_curve[k + 1],
                  color=COLOR_PALETTE[k],
                  label=str(f"[{aps[k]:.3f}]" + types[k]),
              )
          plt.xlabel("recall")
          plt.ylabel("precision")
          plt.xlim(0, 1.0)
          plt.ylim(0, 1.0)
          plt.title(figure_title)
          plt.legend()
          # plt.show()
          export_path = str(Path(outDir) / f"{figure_title}.png")
          fig.savefig(export_path)
          plt.close(fig)
  
          export_path_list.append(export_path)
      return export_path_list
  
file_path: sahi/sahi/scripts/coco_error_analysis.py
imports: import copy
  import os
  from multiprocessing import Pool
  from pathlib import Path
  from typing import List
  import fire
  import numpy
label_desc: Use image node_id 1 for calling a global function with example usage: _makeplot(rs, ps, outDir, class_name, iou_type) and returns: export_path_list