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: Scatter plot of one feature contribution across the prediction set.
  Parameters
  ----------
  feature_values : 1 column pd.Dataframe
      The values of one feature
  contributions : 1 column pd.Dataframe
      The contributions associate
  feature_name : String
      Name of the feature, used in title
  pred: 1 column pd.DataFrame (optional)
      predicted values used to color plot - One Vs All in multiclass case
  proba_values: 1 column pd.DataFrame (optional)
      predicted proba used to color points - One Vs All in multiclass case
  col_modality: Int, Float or String (optional)
      parameter used in classification case,
      specify the modality to color in scatter plot (One Vs All)
  col_scale: list (optional)
      specify the color of points in scatter data
  addnote : String (default: None)
      Specify a note to display
  subtitle : String (default: None)
      Subtitle to display
  width : Int (default: 900)
      Plotly figure - layout width
  height : Int (default: 600)
      Plotly figure - layout height
  file_name: string (optional)
      Specify the save path of html files. If it is not provided, no file will be saved.
  auto_open: bool (default=False)
      open automatically the plot
  zoom: bool (default=False)
      graph is currently zoomed
code: def plot_scatter(
      self,
      feature_values,
      contributions,
      feature_name,
      pred=None,
      proba_values=None,
      col_modality=None,
      col_scale=None,
      metadata=None,
      addnote=None,
      subtitle=None,
      width=900,
      height=600,
      file_name=None,
      auto_open=False,
      zoom=False,
  ):
      """
      Scatter plot of one feature contribution across the prediction set.
      Parameters
      ----------
      feature_values : 1 column pd.Dataframe
          The values of one feature
      contributions : 1 column pd.Dataframe
          The contributions associate
      feature_name : String
          Name of the feature, used in title
      pred: 1 column pd.DataFrame (optional)
          predicted values used to color plot - One Vs All in multiclass case
      proba_values: 1 column pd.DataFrame (optional)
          predicted proba used to color points - One Vs All in multiclass case
      col_modality: Int, Float or String (optional)
          parameter used in classification case,
          specify the modality to color in scatter plot (One Vs All)
      col_scale: list (optional)
          specify the color of points in scatter data
      addnote : String (default: None)
          Specify a note to display
      subtitle : String (default: None)
          Subtitle to display
      width : Int (default: 900)
          Plotly figure - layout width
      height : Int (default: 600)
          Plotly figure - layout height
      file_name: string (optional)
          Specify the save path of html files. If it is not provided, no file will be saved.
      auto_open: bool (default=False)
          open automatically the plot
      zoom: bool (default=False)
          graph is currently zoomed
      """
      fig = go.Figure()
  
      # add break line to X label if necessary
      max_len_by_row = max(
          [
              round(
                  50
                  / self.explainer.features_desc[
                      feature_values.columns.values[0]
                  ]
              ),
              8,
          ]
      )
      feature_values.iloc[:, 0] = feature_values.iloc[:, 0].apply(
          add_line_break,
          args=(
              max_len_by_row,
              120,
          ),
      )
  
      if pred is not None:
          hv_text = [
              f"Id: {x}<br />Predict: {y}"
              for x, y in zip(
                  feature_values.index, pred.values.flatten()
              )
          ]
      else:
          hv_text = [f"Id: {x}" for x in feature_values.index]
  
      if metadata:
          metadata = {
              k: [
                  round_to_k(x, 3) if isinstance(x, Number) else x
                  for x in v
              ]
              for k, v in metadata.items()
          }
          text_groups_features = np.swap = np.array(
              [col_values for col_values in metadata.values()]
          )
          text_groups_features = np.swapaxes(text_groups_features, 0, 1)
          text_groups_features_keys = list(metadata.keys())
          hovertemplate = (
              "<b>%{hovertext}</b><br />"
              + "Contribution: %{y:.4f} <br />"
              + "<br />".join(
                  [
                      "{}: %{{text[{}]}}".format(
                          text_groups_features_keys[i], i
                      )
                      for i in range(len(text_groups_features_keys))
                  ]
              )
              + "<extra></extra>"
          )
      else:
          hovertemplate = (
              "<b>%{hovertext}</b><br />"
              + f"{feature_name}: "
              + "%{customdata[0]}<br />Contribution: %{y:.4f}<extra></extra>"
          )
          text_groups_features = None
  
      fig.add_scatter(
          x=feature_values.values.flatten(),
          y=contributions.values.flatten(),
          mode="markers",
          hovertext=hv_text,
          hovertemplate=hovertemplate,
          text=text_groups_features,
      )
      # To change ticktext when the x label size is upper than 10 and zoom is False
      if (type(feature_values.values.flatten()[0]) == str) & (not zoom):
          feature_val = [
              x.replace("<br />", "")
              for x in feature_values.values.flatten()
          ]
          feature_val = [
              x.replace(x[3 : len(x) - 3], "...") if len(x) > 10 else x
              for x in feature_val
          ]
  
          fig.update_xaxes(
              tickangle=45,
              ticktext=feature_val,
              tickvals=feature_values.values.flatten(),
              tickmode="array",
              dtick=1,
          )
      # Customdata contains the values and index of feature_values.
      # The values are used in the hovertext and the indexes are used for
      # the interactions between the graphics.
      customdata = np.stack(
          (
              feature_values.values.flatten(),
              feature_values.index.values,
          ),
          axis=-1,
      )
  
      fig.update_traces(
          customdata=customdata, hovertemplate=hovertemplate
      )
  
      self._update_contributions_fig(
          fig=fig,
          feature_name=feature_name,
          pred=pred,
          proba_values=proba_values,
          col_modality=col_modality,
          col_scale=col_scale,
          addnote=addnote,
          subtitle=subtitle,
          width=width,
          height=height,
          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 6 for calling the SmartPlotter obj's underlying member method code with example usage: obj.plot_scatter(feature_values, contributions, feature_name, pred, proba_values, col_modality, col_scale, metadata, addnote, subtitle, width, height, file_name, auto_open, zoom) and returns: fig