code: def _plot_ir(data, *, model_name_string, figname):
      # plot for income and region
      _data = data.copy().sort_values(
          by=["trname", "archname", "sz", "income bucket", "region"],
          ascending=False,
      )
      _data["new_model_name"] = _data.apply(
          lambda x: model_name_string.format(**x.to_dict()), axis=1
      )
  
      fig, ax = plt.subplots(1, 2, figsize=(8, 4))
  
      seaborn.lineplot(
          data=_data,
          x="income bucket",
          y="hit",
          hue="new_model_name",
          style="new_model_name",
          ax=ax[0],
      )
  
      seaborn.lineplot(
          data=_data,
          x="region",
          y="hit",
          hue="new_model_name",
          style="new_model_name",
          ax=ax[1],
      )
  
      for i in range(2):
          ax[i].legend_.set_title(None)
          # set axis limits
          mini, maxi = ax[i].get_ylim()
          print(mini, maxi)
          if maxi - floor(10 * maxi) / 10 >= 0.05:
              maxi = ceil(maxi * 10) / 10
              ax[i].set_ylim(mini, maxi)
          ax[i].yaxis.set_major_locator(
              FixedLocator([x / 10 for x in range(11)])
          )
          ax[i].legend(loc="lower right")
          ax[i].grid(
              which="major",
              color="#d3d3d3",
              linestyle="dotted",
              linewidth=1,
          )
  
      fig.tight_layout()
      fig.savefig(figname)
  
      # display dataframes side by side
      ldf = [
          _data.groupby(["income bucket", "new_model_name"])["hit"]
          .mean()
          .reset_index(),
          _data.groupby(["region", "new_model_name"])["hit"]
          .mean()
          .reset_index(),
      ]
      display_html(
          ("\xa0" * 10).join(
              [
                  df.style.set_table_attributes(
                      "style='display:inline'"
                  )._repr_html_()
                  for df in ldf
              ]
          ),
          raw=True,
      )
  
imports: import json
  import os
  from math import ceil, floor
  from pathlib import Path
  import matplotlib.pyplot
  import numpy
  import pandas
  import seaborn
  from IPython.display import display_html
  from matplotlib.ticker import FixedLocator
  from vissl.utils.io import load_file, save_file
label_desc: Use image node_id 12 for calling a global function with example usage: _plot_ir(data) without return types