code: def plot_monthly_ic_heatmap(mean_monthly_ic, ax=None):
      
  
      mean_monthly_ic = mean_monthly_ic.copy()
  
      num_plots = len(mean_monthly_ic.columns)
  
      v_spaces = ((num_plots - 1) // 3) + 1
  
      if ax is None:
          f, ax = plt.subplots(v_spaces, 3, figsize=(18, v_spaces * 6))
          ax = ax.flatten()
  
      new_index_year = []
      new_index_month = []
      for date in mean_monthly_ic.index:
          new_index_year.append(date.year)
          new_index_month.append(date.month)
  
      mean_monthly_ic.index = pd.MultiIndex.from_arrays(
          [new_index_year, new_index_month],
          names=["year", "month"])
  
      for a, (periods_num, ic) in zip(ax, mean_monthly_ic.iteritems()):
  
          sns.heatmap(
              ic.unstack(),
              annot=True,
              alpha=1.0,
              center=0.0,
              annot_kws={"size": 7},
              linewidths=0.01,
              linecolor='white',
              cmap=cm.coolwarm_r,
              cbar=False,
              ax=a)
          a.set(ylabel='', xlabel='')
  
          a.set_title("Monthly Mean {} Period IC".format(periods_num))
  
      if num_plots < len(ax):
          ax[-1].set_visible(False)
  
      return ax
docs: Plots a heatmap of the information coefficient or returns by month.
  
      Parameters
      ----------
      mean_monthly_ic : pd.DataFrame
          The mean monthly IC for N periods forward.
  
      Returns
      -------
      ax : matplotlib.Axes
          The axes that were plotted on.