code: def vis_joints(joints, factor=0.6451607):
      # joints: keys indicate the title(2d/3d), values contain the joints in numpy format
      for k, v in joints.items():
          if "3d" in k and "gt" not in k:
              # back to original scale
              joints[k] = (
                  joints[k] - joints[k][:, 13:14].copy()
              ) * factor
      titles_2d = [item for item in joints if "2d" in item]
      joints_2d = [joints[title] for title in titles_2d]
      titles_3d = [item for item in joints if "3d" in item]
      joints_3d = [joints[title] for title in titles_3d]
      all_titles = titles_2d + titles_3d
      all_joints = joints_2d + joints_3d
      rows, cols = min(2, all_joints[0].shape[0]), len(all_joints)
  
      figsize = (4 * cols, 4 * rows)
      fig = plt.figure(figsize=figsize)
      plt.subplots_adjust(wspace=0.05, hspace=0.05)
      row = 0
  
      for idx in range(rows * cols):
          title, joints = all_titles[idx % cols], all_joints[idx % cols]
          if idx % cols == 0 and idx > 0:
              row += 1
          joints = joints[row]
          if "2d" in title:
              ax = fig.add_subplot(rows, cols, idx + 1)
          else:
              ax = fig.add_subplot(rows, cols, idx + 1, projection="3d")
          ax.set_title(title)
          for pair in pairs:
              if pair in pairs_left:
                  color = "blue"
              elif pair in pairs_right:
                  color = "green"
              else:
                  color = "orange"
              i, j = pair
              if "2d" in title:
                  ax.plot(
                      [joints[i, 0], joints[j, 0]],
                      [-joints[i, 1], -joints[j, 1]],
                      c=color,
                  )
                  ax.get_xaxis().set_visible(False)
                  ax.get_yaxis().set_visible(False)
                  ax.set_axis_off()
              else:
                  ax.plot(
                      [joints[i, 2], joints[j, 2]],
                      [joints[i, 0], joints[j, 0]],
                      [-joints[i, 1], -joints[j, 1]],
                      c=color,
                  )
                  xroot, yroot, zroot = (
                      joints[13, 0],
                      -joints[13, 1],
                      joints[13, 2],
                  )
                  ax.set_ylim3d([-radius + xroot, radius + xroot])
                  ax.set_zlim3d([-radius + yroot, radius + yroot])
                  ax.set_xlim3d([-radius + zroot, radius + zroot])
                  ax.w_xaxis.set_pane_color(white)
                  ax.w_yaxis.set_pane_color(white)
  
                  ax.w_xaxis.line.set_color(white)
                  ax.w_yaxis.line.set_color(white)
                  ax.w_zaxis.line.set_color(white)
                  ax.get_xaxis().set_ticklabels([])
                  ax.get_yaxis().set_ticklabels([])
                  ax.set_zticklabels([])
  
      name = str(time.time()).replace(".", "0") + ".png"
      plt.savefig(name)
      img = imread(name)
      os.remove(name)
      return img
  
file_path: insightface/body/human_pose/ambiguity_aware/lib/utils/vis.py
imports: import os
  import time
  import random
  import numpy
  import matplotlib
  import matplotlib.pyplot
  import seaborn
  from imageio import imread
  from mpl_toolkits.mplot3d import Axes3D
  import warnings
label_desc: Use image node_id 1 for calling a global function with example usage: vis_joints(joints, factor) and returns: img