code: def draw_xy_grid(xs, ys, x_label, y_label, cell):
      res = []
  
      ver_texts = [[images.GridAnnotation(y_label(y))] for y in ys]
      hor_texts = [[images.GridAnnotation(x_label(x))] for x in xs]
  
      first_processed = None
  
      state.job_count = len(xs) * len(ys)
  
      for iy, y in enumerate(ys):
          for ix, x in enumerate(xs):
              state.job = (
                  f"{ix + iy * len(xs) + 1} out of {len(xs) * len(ys)}"
              )
  
              processed = cell(x, y)
              if first_processed is None:
                  first_processed = processed
  
              res.append(processed.images[0])
  
      grid = images.image_grid(res, rows=len(ys))
      grid = images.draw_grid_annotations(
          grid, res[0].width, res[0].height, hor_texts, ver_texts
      )
  
      first_processed.images = [grid]
  
      return first_processed
  
file_path: stable-diffusion-webui/scripts/prompt_matrix.py
imports: import math
  import modules.scripts
  import gradio
  from modules import images
  from modules.processing import process_images
  from modules.shared import opts, state
  import modules.sd_samplers
label_desc: Use image node_id 1 for calling a global function with example usage: draw_xy_grid(xs, ys, x_label, y_label, cell) and returns: first_processed