code: def plot(values, mode_names, title, (xlabel, ylabel), out_file):
      
      matplotlib.pyplot.clf()
      for mode, mode_name in mode_names.iteritems():
          vals = values[mode]
          matplotlib.pyplot.plot(
              [x for x, _ in vals],
              [y for _, y in vals],
              label=mode_name
          )
      matplotlib.pyplot.title(title)
      matplotlib.pyplot.xlabel(xlabel)
      matplotlib.pyplot.ylabel(ylabel)
      if len(mode_names) > 1:
          matplotlib.pyplot.legend()
      matplotlib.pyplot.savefig(out_file)
docs: Plot a diagram