Generate linear extrapolation plot.

  Args:
      log_prob_adv_array: Numpy array containing log probabilities
      y: Tf placeholder for the labels
      file_name: Plot filename
      min_epsilon: Minimum value of epsilon over the interval
      max_epsilon: Maximum value of epsilon over the interval
      num_points: Number of points used to interpolate

def linear_extrapolation_plot(log_prob_adv_array, y, file_name,
                              min_epsilon=-10, max_epsilon=10,
                              num_points=21):
  """Generate linear extrapolation plot.

  Args:
      log_prob_adv_array: Numpy array containing log probabilities
      y: Tf placeholder for the labels
      file_name: Plot filename
      min_epsilon: Minimum value of epsilon over the interval
      max_epsilon: Maximum value of epsilon over the interval
      num_points: Number of points used to interpolate
  """
  import matplotlib
  matplotlib.use('Agg')
  import matplotlib.pyplot as plt

  figure = plt.figure()
  figure.canvas.set_window_title('Cleverhans: Linear Extrapolation Plot')

  correct_idx = np.argmax(y, axis=0)
  fig = plt.figure()
  plt.xlabel('Epsilon')
  plt.ylabel('Logits')
  x_axis = np.linspace(min_epsilon, max_epsilon, num_points)
  plt.xlim(min_epsilon - 1, max_epsilon + 1)
  for i in range(y.shape[0]):
    if i == correct_idx:
      ls = '-'
      linewidth = 5
    else:
      ls = '--'
      linewidth = 2
    plt.plot(
        x_axis,
        log_prob_adv_array[:, i],
        ls=ls,
        linewidth=linewidth,
        label='{}'.format(i))
  plt.legend(loc='best', fontsize=14)
  plt.show()
  fig.savefig(file_name)
  plt.clf()
  return figure