code: def set_figure(self, fig=None):
      self.temp_file.seek(0)
      dark = (
          self.store is not None
          and self.store.settings.theme.value == "dark"
      )
      fig_type = get_figure_type(fig)
  
      if fig is None:
          html = ""
      elif fig_type == "plotly":
          from plotly.io import to_html
  
          if dark:
              fig.update_layout(template="plotly_dark", autosize=True)
          html = to_html(fig, config={"responsive": True})
      elif fig_type == "bokeh":
          from bokeh.resources import CDN
          from bokeh.embed import file_html
  
          html = file_html(fig, resources=CDN, title="my fig")
      elif fig_type == "matplotlib":
          fig = fig.get_figure() or fig
          import base64
          from io import BytesIO
  
          tmpfile = BytesIO()
          fig.savefig(tmpfile, format="png")
          encoded = base64.b64encode(tmpfile.getvalue()).decode("utf-8")
          html = "<img src='data:image/png;base64,{}'>".format(encoded)
      elif fig_type == "altair":
          fig = fig.properties(width="container", height="container")
          from io import StringIO
  
          tmp = StringIO()
          fig.save(tmp, format="html")
          html = tmp.getvalue()
  
      else:
          raise TypeError
  
      html = html.replace(
          "<style>",
          "<style>" "body{margin: 0; width:100vw; height:100vh;} "
          # https://github.com/vega/react-vega/issues/85#issuecomment-795138175
          ".vega-embed{width:100%; height:100%;} ",
      )
  
      self.temp_file.write(html)
      self.temp_file.truncate()
      self.temp_file.seek(0)
      self.load(QtCore.QUrl.fromLocalFile(self.temp_file.name))
  
file_path: PandasGUI/pandasgui/widgets/figure_viewer.py
imports: import os
  import sys
  import tempfile
  from PyQt5 import QtCore, QtGui, QtWidgets, sip
  from PyQt5.QtCore import Qt
  import PyQt5
  import logging
  from pandasgui.store import PandasGuiStoreItem
  from pandasgui.utility import get_figure_type
label_desc: Use image node_id 2 for calling the FigureViewer obj's underlying member method code with example usage: obj.set_figure(fig) without return types