code: def _get_figure_with_position(
      position: dict,
      label_data: pd.DataFrame,
      start_date=None,
      end_date=None,
  ) -> Iterable[go.Figure]:
      """Get average analysis figures
  
      :param position: position
      :param label_data:
      :param start_date:
      :param end_date:
      :return:
      """
      _position_df = get_position_data(
          position,
          label_data,
          calculate_label_rank=True,
          start_date=start_date,
          end_date=end_date,
      )
  
      res_dict = dict()
      _pos_gp = _position_df.groupby(level=1)
      for _item in _pos_gp:
          _date = _item[0]
          _day_df = _item[1]
  
          _day_value = res_dict.setdefault(_date, {})
          for _i, _name in {0: "Hold", 1: "Buy", -1: "Sell"}.items():
              _temp_df = _day_df[_day_df["status"] == _i]
              if _temp_df.empty:
                  _day_value[_name] = 0
              else:
                  _day_value[_name] = _temp_df[
                      "rank_label_mean"
                  ].values[0]
  
      _res_df = pd.DataFrame.from_dict(res_dict, orient="index")
      # FIXME: support HIGH-FREQ
      _res_df.index = _res_df.index.strftime("%Y-%m-%d")
      for _col in _res_df.columns:
          yield ScatterGraph(
              _res_df.loc[:, [_col]],
              layout=dict(
                  title=_col,
                  xaxis=dict(type="category", tickangle=45),
                  yaxis=dict(title="lable-rank-ratio: %"),
              ),
              graph_kwargs=dict(mode="lines+markers"),
          ).figure
  
file_path: qlib/qlib/contrib/report/analysis_position/rank_label.py
imports: import copy
  from typing import Iterable
  import pandas
  import plotly.graph_objs
  from ..graph import ScatterGraph
  from ..analysis_position.parse_position import get_position_data
label_desc: Use image node_id 1 for calling a global function with example usage: _get_figure_with_position(position, label_data, start_date, end_date) without return types