code: def plot_return(
      result: pd.DataFrame(),
      column_as_x: str,
      if_need_calc_return: bool,
      savefig_filename: str = "fig/result.png",
      xlabel: str = "Date",
      ylabel: str = "Return",
      if_transfer_date: bool = True,
      select_start_date: str = None,
      select_end_date: str = None,
      num_days_xticks: int = 20,
      xrotation: int = 0,
  ):
      if select_start_date is None:
          select_start_date: str = result[column_as_x].iloc[0]
          select_end_date: str = result[column_as_x].iloc[-1]
      # calc returns if if_need_calc_return is True, so that result stores returns
      select_start_date_index = (
          result[column_as_x].tolist().index(select_start_date)
      )
      columns = result.columns
      columns_strtegy = []
      column_as_x_index = None
      for i in range(len(columns)):
          col = columns[i]
          if col == column_as_x:
              column_as_x_index = i
          elif "Unnamed" not in col:
              columns_strtegy.append(col)
              if if_need_calc_return:
                  result[col] = (
                      result[col] / result[col][select_start_date_index]
                      - 1
                  )
  
      # select the result between select_start_date and select_end_date
      # if date is 2020-01-15, transfer it to 01/15/2020
      num_rows, num_cols = result.shape
      tmp_result = copy.deepcopy(result)
      result = pd.DataFrame()
      if_first_row = True
      columns = []
      for i in range(num_rows):
          if (
              str2date(select_start_date)
              <= str2date(tmp_result[column_as_x][i])
              <= str2date(select_end_date)
          ):
              if (
                  "-" in tmp_result.iloc[i][column_as_x]
                  and if_transfer_date
              ):
                  new_date = transfer_date(
                      tmp_result.iloc[i][column_as_x]
                  )
              else:
                  new_date = tmp_result.iloc[i][column_as_x]
              tmp_result.iloc[i, column_as_x_index] = new_date
              # print("tmp_result.iloc[i]: ", tmp_result.iloc[i])
              # result = result.append(tmp_result.iloc[i])
              if if_first_row:
                  columns = tmp_result.iloc[i].index.tolist()
                  result = pd.DataFrame(columns=columns)
                  # result = pd.concat([result, tmp_result.iloc[i]], axis=1)
                  # result = pd.DataFrame(tmp_result.iloc[i])
                  # result.columns = tmp_result.iloc[i].index.tolist()
                  if_first_row = False
              row = pd.DataFrame(
                  [tmp_result.iloc[i].tolist()], columns=columns
              )
              result = pd.concat([result, row], axis=0)
  
      # print final return of each strategy
      final_return = {}
      for col in columns_strtegy:
          final_return[col] = result.iloc[-1][col]
      print("final return: ", final_return)
  
      result.reindex()
  
      plot_result(
          result=result,
          column_as_x=column_as_x,
          savefig_filename=savefig_filename,
          xlabel=xlabel,
          ylabel=ylabel,
          num_days_xticks=num_days_xticks,
          xrotation=xrotation,
      )
  
imports: from __future__ import annotations
  import copy
  import datetime
  from copy import deepcopy
  import matplotlib.dates
  import matplotlib.pyplot
  import numpy
  import pandas
  import pyfolio
  from pyfolio import timeseries
  from finrl import config
  from finrl.meta.data_processors.func import date2str
  from finrl.meta.data_processors.func import str2date
  from finrl.meta.preprocessor.yahoodownloader import YahooDownloader
label_desc: Use image node_id 11 for calling a global function with example usage: plot_return(result, column_as_x, if_need_calc_return, savefig_filename, xlabel, ylabel, if_transfer_date, select_start_date, select_end_date, num_days_xticks, xrotation) without return types