class_docstr: Explanation object specific to class histogram 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, COLORS
      import plotly.graph_objs as go
  
      data_dict = self.data(key)
      if data_dict is None:
          return None
  
      # Show overall graph
      if key is None:
          y = data_dict["y"]
          values, counts = np.unique(y, return_counts=True)
          trace1 = go.Bar(x=[values[0]], y=[counts[0]])
          trace2 = go.Bar(x=[values[1]], y=[counts[1]])
          layout = go.Layout(
              title="Response Distribution",
              showlegend=False,
              xaxis=dict(type="category"),
          )
          fig = go.Figure(data=[trace1, trace2], layout=layout)
          return fig
  
      # Show feature graph
      x = data_dict["x"]
      y = data_dict["y"]
  
      column_name = self.feature_names[key]
  
      classes = list(sorted(set(y)))
      data = []
      is_categorical = (
          self.feature_types[key] == "nominal"
          or self.feature_types[key] == "ordinal"
      )
      if not is_categorical:
          _, bins = np.histogram(x, bins="doane")
      for idx, current_class in enumerate(classes):
          x_filt = x[y == current_class]
          if is_categorical:
              values, counts = np.unique(x_filt, return_counts=True)
          else:
              counts, values = np.histogram(x_filt, bins=bins)
  
          data_dict = {
              "data_type": "univariate",
              "names": values,
              "scores": counts,
          }
          fig = plot_density(
              data_dict,
              color=COLORS[idx],
              name=str(current_class),
              is_categorical=is_categorical,
          )
          data.append(fig["data"][0])
  
      layout = go.Layout(
          title=column_name,
          barmode="stack",
          # hoverlabel=dict(font=dict(size=25))
      )
      figure = go.Figure(data, layout)
      figure["layout"]["yaxis1"].update(title="Density")
  
      return figure
  
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 ClassHistogramExplanation obj's underlying member method code with example usage: obj.visualize(key) and returns: figure, None, fig