code: def plot_roc(df_list, colors, title):
      fig = go.Figure()
      grid_points = 101
      for i, df in enumerate(df_list):
          tpr_temp = (
              df.loc[:, ["y_hat", "y"]]
              .groupby("y_hat")
              .sum()
              .reset_index()
              .sort_values("y_hat", ascending=False)
          )
          fpr_temp = (
              df.loc[:, ["y_hat"]]
              .assign(y=1 - df.y)
              .groupby("y_hat")
              .sum()
              .reset_index()
              .sort_values("y_hat", ascending=False)
          )
  
          _df = pd.DataFrame(
              {
                  "tpr": tpr_temp.y.cumsum() / df.y.sum(),
                  "fpr": fpr_temp.y.cumsum() / (1 - df.y).sum(),
              }
          )
  
          if _df.shape[0] > grid_points:
              _df = _df.sample(grid_points).sort_values(
                  "fpr", ascending=True
              )
  
          fig.add_scatter(
              x=[0] + _df["fpr"].tolist(),
              y=[0] + _df["tpr"].tolist(),
              line_shape="hv",
              name=df.iloc[0, df.columns.get_loc("label")],
              marker=dict(color=colors[i]),
          )
  
      fig.update_yaxes(
          {
              "type": "linear",
              "gridwidth": 2,
              "zeroline": False,
              "automargin": True,
              "ticks": "outside",
              "tickcolor": "white",
              "ticklen": 10,
              "fixedrange": True,
              "title_text": "True positive rate",
          }
      )
  
      fig.update_xaxes(
          {
              "type": "linear",
              "gridwidth": 2,
              "zeroline": False,
              "automargin": True,
              "ticks": "outside",
              "tickcolor": "white",
              "ticklen": 10,
              "fixedrange": True,
              "title_text": "False positive rate",
          }
      )
      title = (
          "Receiver Operating Characteristic"
          if title is None
          else title
      )
      fig.update_layout(
          title_text=title,
          title_x=0.15,
          font={"color": "#371ea3"},
          template="none",
          margin={"t": 78, "b": 71, "r": 30},
      )
  
      return fig
  
imports: import numpy
  import pandas
  import plotly.graph_objects
label_desc: Use image node_id 3 for calling a global function with example usage: plot_roc(df_list, colors, title) and returns: fig