code: def _check_plot_works(
      f, filterwarnings="always", **kwargs
  ):  # pragma: no cover
      import matplotlib.pyplot as plt
  
      ret = None
      with warnings.catch_warnings():
          warnings.simplefilter(filterwarnings)
          try:
              try:
                  fig = kwargs["figure"]
              except KeyError:
                  fig = plt.gcf()
  
              plt.clf()
  
              kwargs.get("ax", fig.add_subplot(211))
              ret = f(**kwargs)
  
              assert_is_valid_plot_return_object(ret)
  
              if f is pd.plotting.bootstrap_plot:
                  assert "ax" not in kwargs
              else:
                  kwargs["ax"] = fig.add_subplot(212)
  
              ret = f(**kwargs)
              assert_is_valid_plot_return_object(ret)
  
              with tempfile.TemporaryFile() as path:
                  plt.savefig(path)
          finally:
              close(fig)
  
          return ret
  
file_path: mars/mars/dataframe/plotting/tests/test_plot.py
imports: import warnings
  import tempfile
  import numpy
  import pandas
  import pytest
  from ....None import tensor
  from ....None import dataframe
label_desc: Use image node_id 3 for calling a global function with example usage: _check_plot_works(f, filterwarnings) and returns: ret