code: def residplot(
      data=None,
      *,
      x=None,
      y=None,
      x_partial=None,
      y_partial=None,
      lowess=False,
      order=1,
      robust=False,
      dropna=True,
      label=None,
      color=None,
      scatter_kws=None,
      line_kws=None,
      ax=None,
  ):
      """Plot the residuals of a linear regression.
  
      This function will regress y on x (possibly as a robust or polynomial
      regression) and then draw a scatterplot of the residuals. You can
      optionally fit a lowess smoother to the residual plot, which can
      help in determining if there is structure to the residuals.
  
      Parameters
      ----------
      data : DataFrame, optional
          DataFrame to use if `x` and `y` are column names.
      x : vector or string
          Data or column name in `data` for the predictor variable.
      y : vector or string
          Data or column name in `data` for the response variable.
      {x, y}_partial : vectors or string(s) , optional
          These variables are treated as confounding and are removed from
          the `x` or `y` variables before plotting.
      lowess : boolean, optional
          Fit a lowess smoother to the residual scatterplot.
      order : int, optional
          Order of the polynomial to fit when calculating the residuals.
      robust : boolean, optional
          Fit a robust linear regression when calculating the residuals.
      dropna : boolean, optional
          If True, ignore observations with missing data when fitting and
          plotting.
      label : string, optional
          Label that will be used in any plot legends.
      color : matplotlib color, optional
          Color to use for all elements of the plot.
      {scatter, line}_kws : dictionaries, optional
          Additional keyword arguments passed to scatter() and plot() for drawing
          the components of the plot.
      ax : matplotlib axis, optional
          Plot into this axis, otherwise grab the current axis or make a new
          one if not existing.
  
      Returns
      -------
      ax: matplotlib axes
          Axes with the regression plot.
  
      See Also
      --------
      regplot : Plot a simple linear regression model.
      jointplot : Draw a :func:`residplot` with univariate marginal distributions
                  (when used with ``kind="resid"``).
  
      Examples
      --------
  
      .. include:: ../docstrings/residplot.rst
  
      """
      plotter = _RegressionPlotter(
          x,
          y,
          data,
          ci=None,
          order=order,
          robust=robust,
          x_partial=x_partial,
          y_partial=y_partial,
          dropna=dropna,
          color=color,
          label=label,
      )
  
      if ax is None:
          ax = plt.gca()
  
      # Calculate the residual from a linear regression
      _, yhat, _ = plotter.fit_regression(grid=plotter.x)
      plotter.y = plotter.y - yhat
  
      # Set the regression option on the plotter
      if lowess:
          plotter.lowess = True
      else:
          plotter.fit_reg = False
  
      # Plot a horizontal line at 0
      ax.axhline(0, ls=":", c=".2")
  
      # Draw the scatterplot
      scatter_kws = {} if scatter_kws is None else scatter_kws.copy()
      line_kws = {} if line_kws is None else line_kws.copy()
      plotter.plot(ax, scatter_kws, line_kws)
      return ax
  
imports: import copy
  from textwrap import dedent
  import warnings
  import numpy
  import pandas
  import matplotlib
  import matplotlib.pyplot
  from .None import utils
  from .None import algorithms
  from .axisgrid import FacetGrid, _facet_docs
label_desc: Use image node_id 3 for calling a global function with example usage: residplot(data) and returns: ax