class_docstr: SmartPlotter is a Bridge pattern decoupling plotting functions from SmartExplainer.
  The smartplotter class includes all the methods used to display graphics
  Each SmartPlotter method is easy to use from a Smart explainer object,
  just use the following syntax
  Attributes :
  explainer: object
      SmartExplainer instance to point to.
  Example
  --------
  >>> xpl.plot.my_plot_method(param=value)
class_docstr_tok: ["SmartPlotter","is","a","Bridge","pattern","decoupling","plotting","functions","from","SmartExplainer",".","The","smartplotter","class","includes","all","the","methods","used","to","display","graphics","Each","SmartPlotter","method","is","easy","to","use","from","a","Smart","explainer","object",",","just","use","the","following","syntax","Attributes",":","explainer",":","object","SmartExplainer","instance","to","point","to",".","Example","--","--","--","--",">",">",">","xpl.plot.my_plot_method","(","param=value",")"]
docstr: Intermediate function used to display the stability plot when plot_type is "boxplot" or
  "violin"
  Parameters
  ----------
  variability: array
      Local stability expressed as a distribution across all instances
      (one distribution per feature). Displayed on the X-axis on the plot
  plot_type: string
      Defines the type of plot that will be displayed.
      Possible values are "boxplot" or "violin"
  mean_amplitude: array
      Average of the normalized SHAP values in the neighborhood.
      Displayed as a colorscale in the plot.
  dataset: DataFrame
      x_init dataset
  column_names: list
      Columns names that are displayed on the plot
  file_name: string
      Specify the save path of html files. If it is not provided, no file will be saved
  auto_open: bool
      open automatically the plot
  Returns
  -------
  go.Figure
code: def plot_stability_distribution(
      self,
      variability,
      plot_type,
      mean_amplitude,
      dataset,
      column_names,
      file_name,
      auto_open,
  ):
      """
      Intermediate function used to display the stability plot when plot_type is "boxplot" or
      "violin"
      Parameters
      ----------
      variability: array
          Local stability expressed as a distribution across all instances
          (one distribution per feature). Displayed on the X-axis on the plot
      plot_type: string
          Defines the type of plot that will be displayed.
          Possible values are "boxplot" or "violin"
      mean_amplitude: array
          Average of the normalized SHAP values in the neighborhood.
          Displayed as a colorscale in the plot.
      dataset: DataFrame
          x_init dataset
      column_names: list
          Columns names that are displayed on the plot
      file_name: string
          Specify the save path of html files. If it is not provided, no file will be saved
      auto_open: bool
          open automatically the plot
      Returns
      -------
      go.Figure
      """
      # Store distribution of variability in a DataFrame
      var_df = pd.DataFrame(variability, columns=column_names)
      mean_amplitude_normalized = (
          pd.Series(mean_amplitude, index=column_names)
          / mean_amplitude.max()
      )
  
      # And sort columns by mean amplitude
      var_df = var_df[column_names[mean_amplitude.argsort()]]
  
      # Add colorscale
      col_scale = self.tuning_colorscale(pd.DataFrame(mean_amplitude))
      color_list = mean_amplitude_normalized.tolist()
      color_list.sort()
      color_list = [
          next(pair[1] for pair in col_scale if x <= pair[0])
          for x in color_list
      ]
      height_value = max(
          500,
          40 * dataset.shape[1]
          if dataset.shape[1] < 100
          else 13 * dataset.shape[1],
      )
  
      xaxis_title = "Normalized local contribution value variability"
      yaxis_title = ""
  
      # Plot the distribution
      if dataset.shape[1] < 500:
          fig = go.Figure()
          for i, c in enumerate(var_df):
              if plot_type == "boxplot":
                  fig.add_trace(
                      go.Box(
                          x=var_df[c],
                          marker_color=color_list[i],
                          name=c,
                          showlegend=False,
                      )
                  )
              elif plot_type == "violin":
                  fig.add_trace(
                      go.Violin(
                          x=var_df[c],
                          line_color=color_list[i],
                          name=c,
                          showlegend=False,
                      )
                  )
  
          # Dummy invisible plot to add the color scale
          colorbar_trace = go.Scatter(
              x=[None],
              y=[None],
              mode="markers",
              marker=dict(
                  size=1,
                  color=[mean_amplitude.min(), mean_amplitude.max()],
                  colorscale=col_scale,
                  colorbar=dict(
                      thickness=20,
                      lenmode="pixels",
                      len=300,
                      yanchor="top",
                      y=1,
                      ypad=60,
                      title="Importance<br />(Average contributions)",
                  ),
                  showscale=True,
              ),
              hoverinfo="none",
              showlegend=False,
          )
  
          fig.add_trace(colorbar_trace)
  
          fig.update_layout(
              height=height_value,
          )
  
          self._update_stability_fig(
              fig=fig,
              x_barlen=len(mean_amplitude),
              y_bar=column_names,
              xaxis_title=xaxis_title,
              yaxis_title=yaxis_title,
              file_name=file_name,
              auto_open=auto_open,
          )
  
          return fig
  
imports: import warnings
  from numbers import Number
  import random
  import copy
  import math
  import numpy
  from scipy.optimize import fsolve
  import scipy.cluster.hierarchy
  import pandas
  from plotly import graph_objs
  import plotly.express
  from plotly.subplots import make_subplots
  from plotly.offline import plot
  from shapash.manipulation.select_lines import select_lines
  from shapash.manipulation.summarize import compute_features_import, project_feature_values_1d, compute_corr
  from shapash.utils.utils import add_line_break, truncate_str, compute_digit_number, add_text, maximum_difference_sort_value, compute_sorted_variables_interactions_list_indices, compute_top_correlations_features
  from shapash.webapp.utils.utils import round_to_k
  from shapash.style.style_utils import colors_loading, select_palette, define_style
label_desc: Use image node_id 27 for calling the SmartPlotter obj's underlying member method code with example usage: obj.plot_stability_distribution(variability, plot_type, mean_amplitude, dataset, column_names, file_name, auto_open) and returns: fig