code: def figure_to_image(figures, close=True):
      """Render matplotlib figure to numpy format.
  
      Note that this requires the ``matplotlib`` package.
  
      Args:
          figure (matplotlib.pyplot.figure) : figure
          close (bool): Flag to automatically close the figure
  
      Returns:
          numpy.array: image in [HWC] order
      """
      import numpy as np
  
      try:
          import matplotlib.pyplot as plt
          import matplotlib.backends.backend_agg as plt_backend_agg
      except ModuleNotFoundError:
          print("please install matplotlib")
  
      def render_to_rgb(figure):
          canvas = plt_backend_agg.FigureCanvasAgg(figure)
          canvas.draw()
          data = np.frombuffer(canvas.buffer_rgba(), dtype=np.uint8)
          w, h = figure.canvas.get_width_height()
          image_hwc = data.reshape([h, w, 4])[:, :, 0:3]
          if close:
              plt.close(figure)
          return image_hwc
  
      image = render_to_rgb(figures)
      return image
  
label_desc: Use image node_id 1 for calling a global function with example usage: figure_to_image(figures, close) and returns: image, image_hwc