class_docstr: Explanation object specific to marginal explainer.
docstr: Provides interactive visualizations.
  
  Args:
      key: Either a scalar or list
          that indexes the internal object for sub-plotting.
          If an overall visualization is requested, pass None.
  
  Returns:
      A Plotly figure.
docstr_tok: ["Provides","interactive","visualizations",".","Args",":","key",":","Either","a","scalar","or","list","that","indexes","the","internal","object","for","sub-plotting",".","If","an","overall","visualization","is","requested",",","pass","None",".","Returns",":","A","Plotly","figure","."]
code: def visualize(self, key=None):
      """Provides interactive visualizations.
  
      Args:
          key: Either a scalar or list
              that indexes the internal object for sub-plotting.
              If an overall visualization is requested, pass None.
  
      Returns:
          A Plotly figure.
      """
      from ..visual.plot import plot_density
      import plotly.graph_objs as go
  
      data_dict = self.data(key)
      if data_dict is None:
          return None
  
      if key is None:
          figure = plot_density(
              data_dict["density"], title="Response", ytitle="Density"
          )
          return figure
  
      # Show feature graph
      density_dict = data_dict["feature_density"]
  
      bin_size = density_dict["names"][1] - density_dict["names"][0]
      is_categorical = (
          self.feature_types[key] == "nominal"
          or self.feature_types[key] == "ordinal"
      )
  
      if is_categorical:
          trace1 = go.Histogram(
              x=data_dict["x"], name="x density", yaxis="y2"
          )
      else:
          trace1 = go.Histogram(
              x=data_dict["x"],
              name="x density",
              yaxis="y2",
              autobinx=False,
              xbins=dict(
                  start=density_dict["names"][0],
                  end=density_dict["names"][-1],
                  size=bin_size,
              ),
          )
      data = []
      resp_density_dict = data_dict["response_density"]
      resp_bin_size = (
          density_dict["names"][1] - density_dict["names"][0]
      )
  
      trace2 = go.Histogram(
          y=data_dict["y"],
          name="y density",
          xaxis="x2",
          autobiny=False,
          ybins=dict(
              start=resp_density_dict["names"][0],
              end=resp_density_dict["names"][-1],
              size=resp_bin_size,
          ),
      )
      data.append(trace1)
      data.append(trace2)
      x = data_dict["feature_samples"]
      y = data_dict["response_samples"]
      if not is_categorical:
          trace3 = go.Scatter(
              x=x,
              y=y,
              mode="markers",
              name="points",
              marker=dict(size=5, opacity=0.5),
          )
          data.append(trace3)
      else:
          trace5 = go.Box(x=x, y=y, name="density")
          data.append(trace5)
  
      corr = data_dict["correlation"]
      do_lo = 0.75
      do_hi = 0.85
      layout = go.Layout(
          showlegend=False,
          autosize=True,
          xaxis=dict(
              title=self.feature_names[key],
              type="category" if is_categorical else "-",
              domain=[0, do_hi],
              showgrid=False,
              zeroline=False,
          ),
          yaxis=dict(
              title="Response",
              domain=[0, do_lo],
              showgrid=False,
              zeroline=False,
          ),
          hovermode="closest",
          xaxis2=dict(
              domain=[do_hi, 1], showgrid=False, zeroline=False
          ),
          yaxis2=dict(
              domain=[do_hi, 1], showgrid=False, zeroline=False
          ),
          title="Pearson Correlation: {0:.3f}".format(corr)
          if corr is not None
          else "",
      )
      fig = go.Figure(data=data, layout=layout)
      return fig
  
imports: from ..api.base import ExplainerMixin, ExplanationMixin
  from ..utils._explanation import gen_name_from_class, gen_global_selector
  import numpy
  from scipy.stats import pearsonr
  from ..utils._clean_x import preclean_X
  from ..utils._clean_simple import clean_dimensions, typify_classification
  from ..utils._unify_data import unify_data
label_desc: Use image node_id 3 for calling the MarginalExplanation obj's underlying member method code with example usage: obj.visualize(key) and returns: fig, None, figure