original_docstring: 
      Plots an `nstd` sigma error ellipse based on the specified covariance
      matrix (`cov`). Additional keyword arguments are passed on to the 
      ellipse patch artist.
  
      :param cov: The 2x2 covariance matrix to base the ellipse on.
      :param pos: The location of the center of the ellipse. Expects a 2-element
          sequence of ``[x0, y0]``.
      :param nstd: The radius of the ellipse in numbers of standard deviations.
          Defaults to 2 standard deviations.
      :param ax: The axis that the ellipse will be plotted on. Defaults to the 
          current axis.
  
      :return: A matplotlib ellipse artist.
      
docstring: Plots an `nstd` sigma error ellipse based on the specified covariance
  matrix (`cov`). Additional keyword arguments are passed on to the
  ellipse patch artist.
docstring_tokens: Plots an ` nstd ` sigma error ellipse based on the specified covariance matrix ( ` cov ` ) . Additional keyword arguments are passed on to the ellipse patch artist .
code: def plot_cov_ellipse(cov, pos, nstd=2, ax=None, **kwargs):
      # Copied from https://github.com/joferkington/oost_paper_code in
      # accordance with its license agreement.
      """
      Plots an `nstd` sigma error ellipse based on the specified covariance
      matrix (`cov`). Additional keyword arguments are passed on to the 
      ellipse patch artist.
  
      :param cov: The 2x2 covariance matrix to base the ellipse on.
      :param pos: The location of the center of the ellipse. Expects a 2-element
          sequence of ``[x0, y0]``.
      :param nstd: The radius of the ellipse in numbers of standard deviations.
          Defaults to 2 standard deviations.
      :param ax: The axis that the ellipse will be plotted on. Defaults to the 
          current axis.
  
      :return: A matplotlib ellipse artist.
      """
      def eigsorted(cov):
          vals, vecs = np.linalg.eigh(cov)
          order = vals.argsort()[::-1]
          return vals[order], vecs[:,order]
  
      if ax is None:
          ax = plt.gca()
  
      vals, vecs = eigsorted(cov)
      theta = np.degrees(np.arctan2(*vecs[:,0][::-1]))
  
      # Width and height are "full" widths, not radius
      width, height = 2 * nstd * np.sqrt(vals)
      ellip = Ellipse(xy=pos, width=width, height=height, angle=theta, **kwargs)
  
      ax.add_artist(ellip)
      return ellip
code_tokens: def plot_cov_ellipse ( cov , pos , nstd = 2 , ax = None , ** kwargs ) : def eigsorted ( cov ) : vals , vecs = np . linalg . eigh ( cov ) order = vals . argsort ( ) [ : : - 1 ] return vals [ order ] , vecs [ : , order ] if ax is None : ax = plt . gca ( ) vals , vecs = eigsorted ( cov ) theta = np . degrees ( np . arctan2 ( * vecs [ : , 0 ] [ : : - 1 ] ) ) width , height = 2 * nstd * np . sqrt ( vals ) ellip = Ellipse ( xy = pos , width = width , height = height , angle = theta , ** kwargs ) ax . add_artist ( ellip ) return ellip
short_docstring: Plots an `nstd` sigma error ellipse based on the specified covariance
  matrix (`cov`).
short_docstring_tokens: Plots an ` nstd ` sigma error ellipse based on the specified covariance matrix ( ` cov ` ) .
comment: # Copied from https://github.com/joferkington/oost_paper_code in$SEP$# accordance with its license agreement.$SEP$"""
      Plots an `nstd` sigma error ellipse based on the specified covariance
      matrix (`cov`). Additional keyword arguments are passed on to the 
      ellipse patch artist.
  
      :param cov: The 2x2 covariance matrix to base the ellipse on.
      :param pos: The location of the center of the ellipse. Expects a 2-element
          sequence of ``[x0, y0]``.
      :param nstd: The radius of the ellipse in numbers of standard deviations.
          Defaults to 2 standard deviations.
      :param ax: The axis that the ellipse will be plotted on. Defaults to the 
          current axis.
  
      :return: A matplotlib ellipse artist.
      """$SEP$# Width and height are "full" widths, not radius