code: def yearly_plots(
      df,
      variable,
      renormalize                   = True,
      horizontal_axis_labels_days   = False,
      horizontal_axis_labels_months = True,
      plot                          = True,
      scatter                       = False,
      linestyle                     = "-",
      linewidth                     = 1,
      s                             = 1
      ):
      
      if not df.index.dtype in ["datetime64[ns]", "<M8[ns]", ">M8[ns]"]:
          log.error("index is not datetime")
          return False
      years = []
      for group in df.groupby(df.index.year):
          years.append(group[1])
      scaler = MinMaxScaler()
      plt.xlabel("days")
      plt.ylabel(variable);
      for year in years:
          if renormalize:
              values = scaler.fit_transform(year[[variable]])
          else:
              values = year[variable]
          if plot:
              plt.plot(year["days_through_year"], values, linestyle = linestyle, linewidth = linewidth, label = year.index.year.values[0])
          if scatter:
              plt.scatter(year["days_through_year"], values, s = s)
      if horizontal_axis_labels_months:
          plt.xticks(
              [     15.5,         45,    74.5,     105, 135.5,    166,  196.5,    227.5,         258,     288.5,        319,      349.5],
              ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]
          )
      plt.legend()
docs: Create yearly plots of a variable in a DataFrame, optionally renormalized.
      It is assumed that the DataFrame index is datetime.