code: def _generate_subplots(
      all_results_df: pd.DataFrame,
      x_axis_metric: str,
      figure_title: str,
      privacy_metrics: Sequence[PrivacyMetric],
  ):
      """Create one subplot per privacy metric for a specified x_axis_metric."""
      fig, axes = plt.subplots(
          1,
          len(privacy_metrics),
          figsize=(5 * len(privacy_metrics) + 3, 5),
      )
      # Set a title for the entire group of subplots.
      fig.suptitle(figure_title)
      if len(privacy_metrics) == 1:
          axes = (axes,)
      for i, privacy_metric in enumerate(privacy_metrics):
          legend_labels = all_results_df[LEGEND_LABEL_STR].unique()
          for legend_label in legend_labels:
              single_label_results = all_results_df.loc[
                  all_results_df[LEGEND_LABEL_STR] == legend_label
              ]
              sorted_label_results = single_label_results.sort_values(
                  x_axis_metric
              )
              axes[i].plot(
                  sorted_label_results[x_axis_metric],
                  sorted_label_results[str(privacy_metric)],
              )
          axes[i].set_xlabel(x_axis_metric)
          axes[i].set_title(
              "%s for %s" % (privacy_metric, ENTIRE_DATASET_SLICE_STR)
          )
      plt.legend(
          legend_labels, loc="upper left", bbox_to_anchor=(1.02, 1)
      )
      fig.tight_layout(
          rect=[0, 0, 1, 0.93]
      )  # Leave space for suptitle.
  
      return fig
  
file_path: privacy/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/privacy_report.py
imports: from typing import Iterable, Sequence
  import matplotlib.pyplot
  import pandas
  from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack.data_structures import AttackResults
  from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack.data_structures import AttackResultsCollection
  from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack.data_structures import AttackResultsDFColumns
  from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack.data_structures import ENTIRE_DATASET_SLICE_STR
  from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack.data_structures import PrivacyMetric
label_desc: Use image node_id 4 for calling a global function with example usage: _generate_subplots(all_results_df, x_axis_metric, figure_title, privacy_metrics) and returns: fig