code: def qqplot(
      data,
      dist=stats.norm,
      distargs=(),
      a=0,
      loc=0,
      scale=1,
      fit=False,
      line=None,
      ax=None,
      **plotkwargs,
  ):
      """
      Q-Q plot of the quantiles of x versus the quantiles/ppf of a distribution.
  
      Can take arguments specifying the parameters for dist or fit them
      automatically. (See fit under Parameters.)
  
      Parameters
      ----------
      data : array_like
          A 1d data array.
      dist : callable
          Comparison distribution. The default is
          scipy.stats.distributions.norm (a standard normal).
      distargs : tuple
          A tuple of arguments passed to dist to specify it fully
          so dist.ppf may be called.
      a : float
          Offset for the plotting position of an expected order statistic, for
          example. The plotting positions are given by (i - a)/(nobs - 2*a + 1)
          for i in range(0,nobs+1)
      loc : float
          Location parameter for dist
      scale : float
          Scale parameter for dist
      fit : bool
          If fit is false, loc, scale, and distargs are passed to the
          distribution. If fit is True then the parameters for dist
          are fit automatically using dist.fit. The quantiles are formed
          from the standardized data, after subtracting the fitted loc
          and dividing by the fitted scale.
      line : {None, "45", "s", "r", "q"}
          Options for the reference line to which the data is compared:
  
          - "45" - 45-degree line
          - "s" - standardized line, the expected order statistics are scaled
            by the standard deviation of the given sample and have the mean
            added to them
          - "r" - A regression line is fit
          - "q" - A line is fit through the quartiles.
          - None - by default no reference line is added to the plot.
  
      ax : AxesSubplot, optional
          If given, this subplot is used to plot in instead of a new figure being
          created.
      **plotkwargs
          Additional matplotlib arguments to be passed to the `plot` command.
  
      Returns
      -------
      Figure
          If `ax` is None, the created figure.  Otherwise the figure to which
          `ax` is connected.
  
      See Also
      --------
      scipy.stats.probplot
  
      Notes
      -----
      Depends on matplotlib. If `fit` is True then the parameters are fit using
      the distribution's fit() method.
  
      Examples
      --------
      >>> import statsmodels.api as sm
      >>> from matplotlib import pyplot as plt
      >>> data = sm.datasets.longley.load()
      >>> exog = sm.add_constant(data.exog)
      >>> mod_fit = sm.OLS(data.endog, exog).fit()
      >>> res = mod_fit.resid # residuals
      >>> fig = sm.qqplot(res)
      >>> plt.show()
  
      qqplot of the residuals against quantiles of t-distribution with 4 degrees
      of freedom:
  
      >>> import scipy.stats as stats
      >>> fig = sm.qqplot(res, stats.t, distargs=(4,))
      >>> plt.show()
  
      qqplot against same as above, but with mean 3 and std 10:
  
      >>> fig = sm.qqplot(res, stats.t, distargs=(4,), loc=3, scale=10)
      >>> plt.show()
  
      Automatically determine parameters for t distribution including the
      loc and scale:
  
      >>> fig = sm.qqplot(res, stats.t, fit=True, line="45")
      >>> plt.show()
  
      The following plot displays some options, follow the link to see the code.
  
      .. plot:: plots/graphics_gofplots_qqplot.py
      """
      probplot = ProbPlot(
          data,
          dist=dist,
          distargs=distargs,
          fit=fit,
          a=a,
          loc=loc,
          scale=scale,
      )
      fig = probplot.qqplot(ax=ax, line=line, **plotkwargs)
      return fig
  
imports: from statsmodels.compat.python import lzip
  import numpy
  from scipy import stats
  from statsmodels.distributions import ECDF
  from statsmodels.regression.linear_model import OLS
  from statsmodels.tools.decorators import cache_readonly
  from statsmodels.tools.tools import add_constant
  from .None import utils
label_desc: Use image node_id 1 for calling a global function with example usage: qqplot(data, dist, distargs, a, loc, scale, fit, line, ax) and returns: fig