code: def plt_overlay_long_df(
      df,
      x_col,
      y_col,
      split_col,
      agg_dict=None,
      agg_col_names=None,
      overlay_color="black",
      agg_col_colors=None,
      plt_title=None,
  ):
      """Overlay by splitting wrt values of a column (split_col).
          If some agg metrics (specified by agg_dict) are also desired,
          we overlay the aggregate metrics as well.
      :param df: pd.DataFrame
          data frame which includes the data
      :param x_col: str
          the column for the values for the x-axis
      :param y_col: str
          the column for the values for the y-axis
      :param split_col: str
          the column which is used to split the data to various
          parts to be overlayed
      :param agg_dict: Optional[dict]
          a dictionary to specify aggregations.
          we could calculate multiple metrics for example mean and median
      :param agg_col_names: optional[list[str]]
          names for the aggregated columns.
          if not provided it will be generated during aggregations
      :param overlay_color: Optional[str]
          the color of the overlayed curves.
          The color will be transparent so we can see the curves overlap
      :param agg_col_colors: Optional[str]
          the color of the aggregate curves
      :param plt_title: Optional[str]
          the title of the plot.
          It will default to y_col if not provided
      """
      g = df.groupby([split_col], as_index=False)
      df_num = len(g)
      alpha = 5.0 / df_num
  
      for name, df0 in g:
          plt.plot(
              df0[x_col],
              df0[y_col],
              color=overlay_color,
              alpha=alpha,
              label=None,
          )
  
      agg_df = None
      if agg_dict is not None:
          g2 = df.groupby([x_col], as_index=False)
          agg_df = g2.agg(agg_dict)
          agg_df.columns = [
              " ".join(col).strip() for col in agg_df.columns.values
          ]
          if agg_col_names is not None:
              agg_df.columns = [x_col] + agg_col_names
  
          if agg_col_colors is None:
              n = len(agg_col_names)
              hsv_tuples = [(x * 1.0 / n, 0.5, 0.5) for x in range(n)]
              rgb_tuples = [colorsys.hsv_to_rgb(*x) for x in hsv_tuples]
              agg_col_colors = rgb_tuples
  
          legend_patches = []
  
          for i in range(len(agg_col_names)):
              col = agg_col_names[i]
              color = agg_col_colors[i]
              plt.plot(
                  agg_df[x_col], agg_df[col], label=col, color=color
              )
              patch = matplotlib.patches.Patch(color=color, label=col)
              legend_patches.append(patch)
  
          plt.legend(labels=agg_col_names, handles=legend_patches)
  
      if plt_title is None:
          plt_title = y_col
  
      plt.title(plt_title)
      plt.xlabel(x_col)
      plt.ylabel(y_col)
  
      return agg_df
  
file_path: greykite/greykite/common/viz/timeseries_plotting_mpl.py
imports: import colorsys
  import matplotlib
  import numpy
  from matplotlib import pyplot
  from pandas.plotting import register_matplotlib_converters
label_desc: Use image node_id 2 for calling a global function with example usage: plt_overlay_long_df(df, x_col, y_col, split_col, agg_dict, agg_col_names, overlay_color, agg_col_colors, plt_title) and returns: agg_df