code: def plotly_pdp(
      pdp_df,
      display_index=None,
      index_feature_value=None,
      index_prediction=None,
      absolute=True,
      plot_lines=True,
      num_grid_lines=100,
      feature_name=None,
      round=2,
      target="",
      units="",
      index_name="index",
  ):
      """Display partial-dependence plot (pdp)
  
      Args:
          pdp_df (pd.DataFrame): Generated from get_pdp_df()
          display_index (int, str, optional): Index to highligh in plot.
              Defaults to None.
          index_feature_value (str, float, optional): value of feature for index.
              Defaults to None.
          index_prediction (float, optional): Baseline prediction for index.
              Defaults to None.
          absolute (bool, optional): Display absolute pdp lines. If false then
              display relative to base. Defaults to True.
          plot_lines (bool, optional): Display selection of individual pdp lines.
              Defaults to True.
          num_grid_lines (int, optional): Number of sample gridlines to display.
              Defaults to 100.
          feature_name (str, optional): Name of the feature. Defaults to None.
          round (int, optional): Rounding to apply to floats. Defaults to 2.
          target (str, optional): Name of target variables. Defaults to "".
          units (str, optional): Units of target variable. Defaults to "".
          index_name (str): identifier for idxs. Defaults to "index".
  
      Returns:
          Plotly fig
      """
      if absolute:
          pdp_mean = pdp_df.mean().round(round).values
      else:
          pdp_mean = (
              pdp_df.mean().round(round).values
              - pdp_df.mean().round(round).values[0]
          )
  
      trace0 = go.Scatter(
          x=pdp_df.columns.values,
          y=pdp_mean,
          mode="lines+markers",
          line=dict(color="grey", width=4),
          name=f"average prediction <br>for different values of <br>{feature_name}",
      )
      data = [trace0]
  
      if display_index is not None:
          trace1 = go.Scatter(
              x=pdp_df.columns.values,
              y=pdp_df.iloc[[display_index]].round(round).values[0]
              if absolute
              else pdp_df.iloc[[display_index]].round(round).values[0]
              - pdp_df.iloc[[display_index]].values[0, 0],
              mode="lines+markers",
              line=dict(color="blue", width=4),
              name=f"prediction for {index_name} {display_index} <br>for different values of <br>{feature_name}",
          )
          data.append(trace1)
      if plot_lines:
          x = pdp_df.columns.values
          pdp_sample = pdp_df.sample(min(num_grid_lines, len(pdp_df)))
          ice_lines = (
              pdp_sample.values
              if absolute
              else pdp_sample.values
              - np.expand_dims(pdp_sample.iloc[:, 0].values, axis=1)
          )
  
          for row in pdp_sample.itertuples(index=False):
              data.append(
                  go.Scatter(
                      x=x,
                      y=tuple(row),
                      mode="lines",
                      hoverinfo="skip",
                      line=dict(color="grey"),
                      opacity=0.1,
                      showlegend=False,
                  )
              )
  
      layout = go.Layout(
          title=f"pdp plot for {feature_name}",
          plot_bgcolor="#fff",
          yaxis=dict(
              title=f"Predicted {target}{f' ({units})' if units else ''}"
          ),
          xaxis=dict(title=feature_name),
      )
  
      fig = go.Figure(data=data, layout=layout)
      shapes = []
      annotations = []
  
      if index_feature_value is not None:
          if not isinstance(index_feature_value, str):
              index_feature_value = np.round(index_feature_value, 2)
  
          shapes.append(
              dict(
                  type="line",
                  xref="x",
                  yref="y",
                  x0=index_feature_value,
                  x1=index_feature_value,
                  y0=pdp_sample.min().min()
                  if plot_lines
                  else pdp_mean.min(),
                  y1=pdp_sample.max().max()
                  if plot_lines
                  else pdp_mean.max(),
                  line=dict(
                      color="MediumPurple",
                      width=4,
                      dash="dot",
                  ),
              )
          )
          annotations.append(
              go.layout.Annotation(
                  x=index_feature_value,
                  y=pdp_sample.min().min()
                  if plot_lines
                  else pdp_mean.min(),
                  text=f"baseline value = {index_feature_value}",
              )
          )
  
      if index_prediction is not None:
          shapes.append(
              dict(
                  type="line",
                  xref="x",
                  yref="y",
                  x0=pdp_df.columns.values[0],
                  x1=pdp_df.columns.values[-1],
                  y0=index_prediction,
                  y1=index_prediction,
                  line=dict(
                      color="MediumPurple",
                      width=4,
                      dash="dot",
                  ),
              )
          )
  
          annotations.append(
              go.layout.Annotation(
                  x=pdp_df.columns[int(0.5 * len(pdp_df.columns))],
                  y=index_prediction,
                  text=f"baseline pred = {index_prediction:.{round}f}",
              )
          )
  
      fig.update_layout(annotations=annotations)
      fig.update_layout(shapes=shapes)
      fig.update_layout(showlegend=False)
      fig.update_layout(margin=dict(t=40, b=40, l=40, r=40))
      return fig
  
imports: import warnings
  import numpy
  import pandas
  from pandas.api.types import is_numeric_dtype
  import plotly.graph_objs
  from plotly.subplots import make_subplots
  from sklearn.metrics import classification_report, confusion_matrix, precision_recall_curve, roc_curve, roc_auc_score, average_precision_score
  from .explainer_methods import matching_cols, safe_isinstance
label_desc: Use image node_id 9 for calling a global function with example usage: plotly_pdp(pdp_df, display_index, index_feature_value, index_prediction, absolute, plot_lines, num_grid_lines, feature_name, round, target, units, index_name) and returns: fig