code: def test_figure(self):
      writer = SummaryWriter()
  
      figure, axes = plt.figure(), plt.gca()
      circle1 = plt.Circle((0.2, 0.5), 0.2, color="r")
      circle2 = plt.Circle((0.8, 0.5), 0.2, color="g")
      axes.add_patch(circle1)
      axes.add_patch(circle2)
      plt.axis("scaled")
      plt.tight_layout()
  
      writer.add_figure("add_figure/figure", figure, 0, close=False)
      assert plt.fignum_exists(figure.number) is True
  
      writer.add_figure("add_figure/figure", figure, 1)
      assert plt.fignum_exists(figure.number) is False
  
      writer.close()
  
file_path: pytorch-tensorboardx/tests/test_figure.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from __future__ import unicode_literals
  import matplotlib
  import matplotlib.pyplot
  import unittest
  from tensorboardX import SummaryWriter
label_desc: Use image node_id 1 for calling the FigureTest obj's underlying member method code with example usage: obj.test_figure() without return types