code: def plot_duplicates(
      image_dir: Union[PurePath, str],
      duplicate_map: Dict,
      filename: str,
      outfile: str = None,
  ) -> None:
      """
      Given filename for an image, plot duplicates along with the original image using the duplicate map obtained using
      find_duplicates method.
  
      Args:
          image_dir: image directory where all files in duplicate_map are present.
          duplicate_map: mapping of filename to found duplicates (could be with or without scores).
          filename: Name of the file for which duplicates are to be plotted, must be a key in the duplicate_map.
          dictionary.
          outfile: Optional, name of the file to save the plot. Default is None.
  
      Example:
      ```
          from imagededup.utils import plot_duplicates
          plot_duplicates(image_dir='path/to/image/directory',
                          duplicate_map=duplicate_map,
                          filename='path/to/image.jpg')
      ```
      """
      # validate args
      image_dir = _validate_args(
          image_dir=image_dir,
          duplicate_map=duplicate_map,
          filename=filename,
      )
  
      retrieved = duplicate_map[filename]
      assert len(retrieved) != 0, "Provided filename has no duplicates!"
  
      # plot
      if isinstance(retrieved[0], tuple):
          _plot_images(
              image_dir=image_dir,
              orig=filename,
              image_list=retrieved,
              scores=True,
              outfile=outfile,
          )
      else:
          _plot_images(
              image_dir=image_dir,
              orig=filename,
              image_list=retrieved,
              scores=False,
              outfile=outfile,
          )
  
file_path: imagededup/imagededup/utils/plotter.py
imports: import matplotlib.gridspec
  import matplotlib.pyplot
  from matplotlib import figure
  from pathlib import Path, PurePath
  from typing import Dict, Union, List
  import numpy
  from PIL import Image
label_desc: Use image node_id 4 for calling a global function with example usage: plot_duplicates(image_dir, duplicate_map, filename, outfile) without return types