code: def plot_quantile_average_cumulative_return(
      avg_cumulative_returns,
      by_quantile=False,
      std_bar=False,
      title=None,
      ax=None,
  ):
      """
      Plots sector-wise mean daily returns for factor quantiles
      across provided forward price movement columns.
  
      Parameters
      ----------
      avg_cumulative_returns: pd.Dataframe
          The format is the one returned by
          performance.average_cumulative_return_by_quantile
      by_quantile : boolean, optional
          Disaggregated figures by quantile (useful to clearly see std dev bars)
      std_bar : boolean, optional
          Plot standard deviation plot
      title: string, optional
          Custom title
      ax : matplotlib.Axes, optional
          Axes upon which to plot.
  
      Returns
      -------
      ax : matplotlib.Axes
      """
  
      avg_cumulative_returns = avg_cumulative_returns.multiply(
          DECIMAL_TO_BPS
      )
      quantiles = len(avg_cumulative_returns.index.levels[0].unique())
      palette = [cm.coolwarm(i) for i in np.linspace(0, 1, quantiles)]
      palette = palette[::-1]  # we want negative quantiles as 'red'
  
      if by_quantile:
          if ax is None:
              v_spaces = ((quantiles - 1) // 2) + 1
              f, ax = plt.subplots(
                  v_spaces,
                  2,
                  sharex=False,
                  sharey=False,
                  figsize=(18, 6 * v_spaces),
              )
              ax = ax.flatten()
  
          for i, (quantile, q_ret) in enumerate(
              avg_cumulative_returns.groupby(level="factor_quantile")
          ):
              mean = q_ret.loc[(quantile, "mean")]
              mean.name = "Quantile " + str(quantile)
              mean.plot(ax=ax[i], color=palette[i])
              ax[i].set_ylabel("Mean Return (bps)")
  
              if std_bar:
                  std = q_ret.loc[(quantile, "std")]
                  ax[i].errorbar(
                      std.index,
                      mean,
                      yerr=std,
                      fmt="none",
                      ecolor=palette[i],
                      label="none",
                  )
  
              ax[i].axvline(x=0, color="k", linestyle="--")
              ax[i].legend()
              i += 1
  
      else:
          if ax is None:
              f, ax = plt.subplots(1, 1, figsize=(18, 6))
  
          for i, (quantile, q_ret) in enumerate(
              avg_cumulative_returns.groupby(level="factor_quantile")
          ):
              mean = q_ret.loc[(quantile, "mean")]
              mean.name = "Quantile " + str(quantile)
              mean.plot(ax=ax, color=palette[i])
  
              if std_bar:
                  std = q_ret.loc[(quantile, "std")]
                  ax.errorbar(
                      std.index,
                      mean,
                      yerr=std,
                      fmt="none",
                      ecolor=palette[i],
                      label="none",
                  )
              i += 1
  
          ax.axvline(x=0, color="k", linestyle="--")
          ax.legend()
          ax.set(
              ylabel="Mean Return (bps)",
              title=(
                  "Average Cumulative Returns by Quantile"
                  if title is None
                  else title
              ),
              xlabel="Periods",
          )
  
      return ax
  
imports: import numpy
  import pandas
  from scipy import stats
  import statsmodels.api
  import seaborn
  import matplotlib.cm
  import matplotlib.pyplot
  from matplotlib.ticker import ScalarFormatter
  from functools import wraps
  from .None import utils
  from .None import performance
label_desc: Use image node_id 20 for calling a global function with example usage: plot_quantile_average_cumulative_return(avg_cumulative_returns, by_quantile, std_bar, title, ax) and returns: ax