code: def analyze(context=None, perf=None):
      end = time.time()
      log.info("elapsed time: {}".format(end - context.start_time))
  
      import matplotlib.pyplot as plt
  
      # The quote currency of the algo exchange
      quote_currency = list(context.exchanges.values())[
          0
      ].quote_currency.upper()
  
      # Plot the portfolio value over time.
      ax1 = plt.subplot(611)
      perf.loc[:, "portfolio_value"].plot(ax=ax1)
      ax1.set_ylabel("Portfolio\nValue\n({})".format(quote_currency))
  
      # Plot the price increase or decrease over time.
      ax2 = plt.subplot(612, sharex=ax1)
      perf.loc[:, "price"].plot(ax=ax2, label="Price")
  
      ax2.set_ylabel(
          "{asset}\n({quote})".format(
              asset=context.market.symbol, quote=quote_currency
          )
      )
  
      transaction_df = extract_transactions(perf)
      if not transaction_df.empty:
          buy_df = transaction_df[transaction_df["amount"] > 0]
          sell_df = transaction_df[transaction_df["amount"] < 0]
          ax2.scatter(
              buy_df.index.to_pydatetime(),
              perf.loc[buy_df.index.floor("1 min"), "price"],
              marker="^",
              s=100,
              c="green",
              label="",
          )
          ax2.scatter(
              sell_df.index.to_pydatetime(),
              perf.loc[sell_df.index.floor("1 min"), "price"],
              marker="v",
              s=100,
              c="red",
              label="",
          )
  
      ax4 = plt.subplot(613, sharex=ax1)
      perf.loc[:, "cash"].plot(
          ax=ax4, label="Quote Currency ({})".format(quote_currency)
      )
      ax4.set_ylabel("Cash\n({})".format(quote_currency))
  
      perf["algorithm"] = perf.loc[:, "algorithm_period_return"]
  
      ax5 = plt.subplot(614, sharex=ax1)
      perf.loc[:, ["algorithm", "price_change"]].plot(ax=ax5)
      ax5.set_ylabel("Percent\nChange")
  
      ax6 = plt.subplot(615, sharex=ax1)
      perf.loc[:, "rsi"].plot(ax=ax6, label="RSI")
      ax6.set_ylabel("RSI")
      ax6.axhline(context.RSI_OVERBOUGHT, color="darkgoldenrod")
      ax6.axhline(context.RSI_OVERSOLD, color="darkgoldenrod")
  
      if not transaction_df.empty:
          ax6.scatter(
              buy_df.index.to_pydatetime(),
              perf.loc[buy_df.index.floor("1 min"), "rsi"],
              marker="^",
              s=100,
              c="green",
              label="",
          )
          ax6.scatter(
              sell_df.index.to_pydatetime(),
              perf.loc[sell_df.index.floor("1 min"), "rsi"],
              marker="v",
              s=100,
              c="red",
              label="",
          )
      plt.legend(loc=3)
      start, end = ax6.get_ylim()
      ax6.yaxis.set_ticks(np.arange(0, end, end / 5))
  
      # Show the plot.
      plt.gcf().set_size_inches(18, 8)
      plt.show()
      pass
  
file_path: catalyst/catalyst/examples/mean_reversion_simple.py
imports: import os
  import tempfile
  import time
  import numpy
  import pandas
  import talib
  from logbook import Logger
  from catalyst import run_algorithm
  from catalyst.api import symbol, record, order_target_percent
  from catalyst.exchange.utils.stats_utils import extract_transactions
  from catalyst.utils.paths import ensure_directory
label_desc: Use image node_id 3 for calling a global function with example usage: analyze(context, perf) without return types