code: def precision_at_proportions(y_true, y_score, ax=None):
      
      if any((val is None for val in (y_true, y_score))):
          raise ValueError('y_true and y_score are needed to plot precision at '
                           'proportions')
  
      if ax is None:
          ax = plt.gca()
  
      y_score_is_vector = is_column_vector(y_score) or is_row_vector(y_score)
      if not y_score_is_vector:
          y_score = y_score[:, 1]
  
      # Calculate points
      proportions = [0.01 * i for i in range(1, 101)]
      precs_and_cutoffs = [precision_at(y_true, y_score, p) for p in proportions]
      precs, cutoffs = zip(*precs_and_cutoffs)
  
      # Plot and set nice defaults for title and axis labels
      ax.plot(proportions, precs)
      ax.set_title('Precision at various proportions')
      ax.set_ylabel('Precision')
      ax.set_xlabel('Proportion')
      ticks = [0.1 * i for i in range(1, 11)]
      ax.set_xticks(ticks)
      ax.set_xticklabels(ticks)
      ax.set_yticks(ticks)
      ax.set_yticklabels(ticks)
      ax.set_ylim([0, 1.0])
      ax.set_xlim([0, 1.0])
      return ax
docs: Plot precision values at different proportions.
  
      Parameters
      ----------
      y_true : array-like
          Correct target values (ground truth).
      y_score : array-like
          Target scores (estimator predictions).
      ax : matplotlib Axes
          Axes object to draw the plot onto, otherwise uses current Axes
  
      Returns
      -------
      ax: matplotlib Axes
          Axes containing the plot