code: def combine_testplots(
      wildcard="mpld3/test_plots/*.py",
      outfile="_test_plots.html",
      pngdir="_pngs",
      d3_url=None,
      mpld3_url=None,
  ):
      """Generate figures from the plots and save to an HTML file
  
      Parameters
      ----------
      wildcard : string or list
          a regexp or list of regexps matching files to test
      outfile : string
          the path at which the output HTML will be saved
      d3_url : string
          the URL of the d3 library to use.  If not specified, a standard web
          address will be used.
      mpld3_url : string
          the URL of the mpld3 library to use.  If not specified, a standard web
          address will be used.
      """
      if isinstance(wildcard, str):
          filenames = glob.glob(wildcard)
      else:
          filenames = itertools.chain(*(glob.glob(w) for w in wildcard))
  
      fig_png = []
      fig_json = []
      fig_name = []
      for filename in filenames:
          result = ExecFile(filename, pngdir=pngdir)
          fig_png.extend(result.iter_png())
          for r in result.iter_json():
              fig_json.append(r)
              fig_name.append(filename)
  
      left_col = [
          MPLD3_TEMPLATE.format(figid=i, fname=fig_name[i])
          for i in range(len(fig_json))
      ]
      js_commands = [
          JS_TEMPLATE.format(
              figid=figid, figure_json=figjson, extra_js=figjs
          )
          for figid, (figjson, figjs, _) in enumerate(fig_json)
      ]
      right_col = [
          '<div>png version</div><div class="fig"><img src="{0}"></div>\n'.format(
              fig
          )
          for fig in fig_png
      ]
      extra_css = [tup[2] for tup in fig_json]
  
      print("writing results to {0}".format(outfile))
      with open(outfile, "w") as f:
          f.write(
              TEMPLATE.format(
                  left_col="".join(left_col),
                  right_col="".join(right_col),
                  d3_url=json.dumps(d3_url),
                  mpld3_url=json.dumps(mpld3_url),
                  js_commands="".join(js_commands),
                  extra_css="".join(extra_css),
              )
          )
  
imports: import os
  import glob
  import sys
  import gc
  import traceback
  import itertools
  import json
  import contextlib
  import matplotlib
  import matplotlib.pyplot
  import mpld3
  from mpld3 import urls
  from mpld3._display import NumpyEncoder
  from mpld3.mpld3renderer import MPLD3Renderer
  from mpld3.mplexporter import Exporter
label_desc: Use image node_id 3 for calling a global function with example usage: combine_testplots(wildcard, outfile, pngdir, d3_url, mpld3_url) without return types