code: def plot(
      metadata: BenchmarkMetadata,
      suite: BenchmarkSuite,
      results_df: pd.DataFrame,
      results_metadata: Collection[BenchmarkMetadata],
      dest: Path,
  ) -> None:
      """Plot previously collected metrics."""
      for benchmark_set in suite.sets:
          benchmark_set_df = benchmark_set.filter_metrics(results_df)
          for file_key, file_df, file_plotters in group(
              benchmark_set_df,
              benchmark_set.plots,
              results_metadata,
              benchmark_set.file_by,
          ):
              row_groups = group(
                  file_df,
                  file_plotters,
                  results_metadata,
                  benchmark_set.row_by,
              )
              n_rows = len(row_groups)
              n_columns = len(
                  group(
                      file_df,
                      file_plotters,
                      results_metadata,
                      benchmark_set.column_by,
                  )
              )
  
              width = 6 * n_columns
              height = 4 * n_rows
              fig, axes = plt.subplots(
                  ncols=n_columns,
                  nrows=n_rows,
                  figsize=(width, height),
                  squeeze=False,
                  dpi=100,
              )
  
              for row_axes, (row_key, row_df, row_plotters) in zip(
                  axes, row_groups
              ):
                  column_groups = group(
                      row_df,
                      row_plotters,
                      results_metadata,
                      benchmark_set.column_by,
                  )
                  for column_ax, (
                      column_key,
                      column_df,
                      column_plotters,
                  ) in zip(row_axes, column_groups):
                      (plotter,) = column_plotters
                      plotter.plot(
                          column_ax,
                          file_key,
                          column_key,
                          row_key,
                          benchmark_set.safe_line_by,
                          column_df,
                          results_metadata,
                      )
  
              fig.tight_layout()
              file_tokens = (benchmark_set.name,) + file_key
              fig.savefig(dest / f"{'_'.join(file_tokens)}.png")
              plt.close(fig)
  
file_path: GPflow/benchmark/plot.py
imports: import argparse
  import json
  from pathlib import Path
  from typing import Collection, Sequence, Tuple
  import matplotlib.pyplot
  import pandas
  import benchmark.benchmarks
  import benchmark.metrics
  from benchmark.benchmark_api import BENCHMARK_SUITES, BenchmarkSuite
  from benchmark.grouping import group
  from benchmark.metadata import BenchmarkMetadata
  from benchmark.paths import setup_dest
label_desc: Use image node_id 2 for calling a global function with example usage: plot(metadata, suite, results_df, results_metadata, dest) without return types