docstr: Args:
      Same as in :meth:`__init__()`.
  
  Returns:
      fig (matplotlib.pyplot.figure): top level container for all the image plot elements.
      ax (matplotlib.pyplot.Axes): contains figure elements and sets the coordinate system.
docstr_tok: ["Args",":","Same","as","in",":","meth",":","`","__init__","(",")","`",".","Returns",":","fig","(","matplotlib.pyplot.figure",")",":","top","level","container","for","all","the","image","plot","elements",".","ax","(","matplotlib.pyplot.Axes",")",":","contains","figure","elements","and","sets","the","coordinate","system","."]
code: def _setup_figure(self, img):
      """
      Args:
          Same as in :meth:`__init__()`.
  
      Returns:
          fig (matplotlib.pyplot.figure): top level container for all the image plot elements.
          ax (matplotlib.pyplot.Axes): contains figure elements and sets the coordinate system.
      """
      fig = mplfigure.Figure(frameon=False)
      self.dpi = fig.get_dpi()
      # add a small 1e-2 to avoid precision lost due to matplotlib's truncation
      # (https://github.com/matplotlib/matplotlib/issues/15363)
      fig.set_size_inches(
          (self.width * self.scale + 1e-2) / self.dpi,
          (self.height * self.scale + 1e-2) / self.dpi,
      )
      self.canvas = FigureCanvasAgg(fig)
      # self.canvas = mpl.backends.backend_cairo.FigureCanvasCairo(fig)
      ax = fig.add_axes([0.0, 0.0, 1.0, 1.0])
      ax.axis("off")
      self.fig = fig
      self.ax = ax
      self.reset_image(img)
  
imports: import colorsys
  import logging
  import math
  import numpy
  from enum import Enum, unique
  import cv2
  import matplotlib
  import matplotlib.colors
  import matplotlib.figure
  import pycocotools.mask
  import torch
  from matplotlib.backends.backend_agg import FigureCanvasAgg
  from PIL import Image
  from detectron2.data import MetadataCatalog
  from detectron2.structures import BitMasks, Boxes, BoxMode, Keypoints, PolygonMasks, RotatedBoxes
  from detectron2.utils.file_io import PathManager
  from .colormap import random_color
label_desc: Use image node_id 2 for calling the VisImage obj's underlying member method code with example usage: obj._setup_figure(img) without return types