code: def plot_gce_explanation(
      explanation,
      plot_width: int = 250,
      plot_height: int = 250,
      plot_bgcolor: str = "white",
      plot_line_width: int = 2,
      plot_instance_size: int = 15,
      plot_instance_color: str = "firebrick",
      plot_instance_width: int = 4,
      plot_contour_coloring: str = "heatmap",
      plot_contour_color: Union[
          str, List[Tuple[float, str]]
      ] = "Portland",
      renderer="notebook",
      title=None,
      **kwargs,
  ):
      exp_data = explanation
      feat_dict = {
          k: len(exp_data[k].keys())
          for k in exp_data["selected_features"]
      }
      features = sorted(feat_dict, key=lambda l: feat_dict[l])
      n_feat = len(features)
  
      specs = [
          [{} if i <= j else None for j in range(n_feat - 1)]
          for i in range(n_feat - 1)
      ]
  
      fig = make_subplots(
          rows=n_feat - 1,
          cols=n_feat - 1,
          specs=specs,
          shared_xaxes="columns",
          shared_yaxes="rows",
          column_titles=features[1:],
          row_titles=features[:-1],
      )
  
      for x_i in range(n_feat):
          for y_i in range(n_feat):
              if y_i < x_i:
                  x_feat = features[x_i]
                  y_feat = features[y_i]
                  z = exp_data[x_feat][y_feat]["gce_values"]
                  x_g = exp_data[x_feat][y_feat]["x_grid"]
                  y_g = exp_data[x_feat][y_feat]["y_grid"]
                  fig.add_trace(
                      go.Contour(
                          z=z,
                          x=x_g,
                          y=y_g,
                          connectgaps=True,
                          line_smoothing=0.5,
                          contours_coloring=plot_contour_coloring,
                          contours_showlabels=True,
                          line_width=plot_line_width,
                          coloraxis="coloraxis1",
                          hovertemplate="<b>"
                          + str(x_feat)
                          + "</b>: %{x:.2f}<br>"
                          + "<b>"
                          + str(y_feat)
                          + "</b>: %{y:.2f}<br>"
                          + "<b>prediction</b>: %{z:.2f}<br><extra></extra>",
                      ),
                      row=y_i + 1,
                      col=x_i,
                  )
                  if "current_values" in exp_data[x_feat][y_feat]:
                      x = exp_data[x_feat][y_feat]["current_values"][
                          x_feat
                      ]
                      y = exp_data[x_feat][y_feat]["current_values"][
                          y_feat
                      ]
                      fig.add_trace(
                          go.Scatter(
                              mode="markers",
                              marker_symbol="x",
                              x=[x],
                              y=[y],
                              marker_color=plot_instance_color,
                              marker_line_color=plot_instance_color,
                              marker_size=plot_instance_size,
                              marker_line_width=plot_instance_width,
                              showlegend=False,
                              hovertemplate="{}: {:.2f}<br> {}: {:.2f}<extra></extra>".format(
                                  x_feat, x, y_feat, y
                              ),
                          ),
                          row=y_i + 1,
                          col=x_i,
                      )
  
      fig.update_layout(
          height=(n_feat - 1) * plot_height,
          width=(n_feat - 1) * plot_width,
          plot_bgcolor=plot_bgcolor,
          coloraxis_autocolorscale=False,
          coloraxis_colorscale=plot_contour_color,
          title_text=title,
      )
      return fig
  
file_path: AIX360/examples/gce/plots.py
imports: from typing import List, Union, Tuple
  import matplotlib.pyplot
  import matplotlib.gridspec
  from plotly import express
  from plotly import graph_objects
  from plotly.subplots import make_subplots
  import plotly.io
  import numpy
label_desc: Use image node_id 2 for calling a global function with example usage: plot_gce_explanation(explanation, plot_width, plot_height, plot_bgcolor, plot_line_width, plot_instance_size, plot_instance_color, plot_instance_width, plot_contour_coloring, plot_contour_color, renderer, title) and returns: fig