code: def precision_at_proportions(y_true, y_score, ax=None):
      """
      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
  
      """
      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
  
imports: import json
  from pathlib import Path
  import numpy
  import matplotlib.pyplot
  from sklearn.metrics import confusion_matrix
  from sklearn_evaluation import __version__
  from ..telemetry import SKLearnEvaluationLogger
  from ..plot.matplotlib import bar
  from ..metrics import precision_at
  from ..None import compute
  from ..util import is_column_vector, is_row_vector, default_heatmap
  from sklearn_evaluation.plot.plot import AbstractPlot, AbstractComposedPlot
  from ..plot import _matrix
  from ploomber_core.exceptions import modify_exceptions
label_desc: Use image node_id 9 for calling a global function with example usage: precision_at_proportions(y_true, y_score, ax) and returns: ax