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: Plotly plot for comparisons. Displays
  the contributions of several individuals. One line represents
  the different contributions of a unique individual.
  Parameters
  ----------
  index: list
      List of index corresponding to the individuals we want to compare.
  feature_values: list
      String list corresponding to the name of the features.
  contributions: numpy.ndarray
      Matrix of contributions.
      Each row corresponds to an individual.
  predictions: list
      List of pandas.Series containing values of individuals.
  dict_features: dict
      Dictionnary of feature names.
  subtitle: string (default : None)
      Subtitle to display.
  width: int (default: 900)
      Plotly figure - layout width
  height: int (default: 550)
      Plotly figure - layout height.
  file_name: string (optional)
      File name to use to save the plotly scatter chart. If None the scatter chart will not be saved.
  auto_open: Boolean (optional)
      Indicate whether to open the scatter plot or not.
  Returns
  -------
  Plotly Figure Object
      Plot of the contributions of individuals, feature by feature.
code: def plot_line_comparison(
      self,
      index,
      feature_values,
      contributions,
      predictions=None,
      dict_features=None,
      subtitle=None,
      width=900,
      height=550,
      file_name=None,
      auto_open=False,
  ):
      """
      Plotly plot for comparisons. Displays
      the contributions of several individuals. One line represents
      the different contributions of a unique individual.
      Parameters
      ----------
      index: list
          List of index corresponding to the individuals we want to compare.
      feature_values: list
          String list corresponding to the name of the features.
      contributions: numpy.ndarray
          Matrix of contributions.
          Each row corresponds to an individual.
      predictions: list
          List of pandas.Series containing values of individuals.
      dict_features: dict
          Dictionnary of feature names.
      subtitle: string (default : None)
          Subtitle to display.
      width: int (default: 900)
          Plotly figure - layout width
      height: int (default: 550)
          Plotly figure - layout height.
      file_name: string (optional)
          File name to use to save the plotly scatter chart. If None the scatter chart will not be saved.
      auto_open: Boolean (optional)
          Indicate whether to open the scatter plot or not.
      Returns
      -------
      Plotly Figure Object
          Plot of the contributions of individuals, feature by feature.
      """
  
      dict_t = copy.deepcopy(self._style_dict["dict_title"])
      topmargin = 80
      dict_xaxis = copy.deepcopy(self._style_dict["dict_xaxis"])
      dict_yaxis = copy.deepcopy(self._style_dict["dict_yaxis"])
  
      if len(index) == 0:
          warnings.warn("No individuals matched", UserWarning)
          dict_t[
              "text"
          ] = "Compare plot - <b>No Matching Reference Entry</b>"
      elif len(index) < 2:
          warnings.warn(
              "Comparison needs at least 2 individuals", UserWarning
          )
          dict_t["text"] = "Compare plot - index : " + " ; ".join(
              ["<b>" + str(id) + "</b>" for id in index]
          )
      else:
          dict_t["text"] = "Compare plot - index : " + " ; ".join(
              ["<b>" + str(id) + "</b>" for id in index]
          )
  
          dict_xaxis["text"] = "Contributions"
  
      dict_yaxis["text"] = None
  
      if subtitle is not None:
          topmargin += 15 * height / 275
          dict_t["text"] = (
              truncate_str(dict_t["text"], 120)
              + f"<span style='font-size: 12px;'><br />{truncate_str(subtitle, 200)}</span>"
          )
  
      layout = go.Layout(
          template="none",
          title=dict_t,
          xaxis_title=dict_xaxis,
          yaxis_title=dict_yaxis,
          yaxis_type="category",
          width=width,
          height=height,
          hovermode="closest",
          legend=dict(x=1, y=1),
          margin={"l": 150, "r": 20, "t": topmargin, "b": 70},
      )
  
      iteration_list = list(zip(contributions, feature_values))
  
      dic_color = copy.deepcopy(self._style_dict["dict_compare_colors"])
      lines = list()
  
      for i, id_i in enumerate(index):
          x_i = list()
          features = list()
          x_val = predictions[i]
          x_hover = list()
  
          for contrib, feat in iteration_list:
              x_i.append(contrib[i])
              features.append("<b>" + str(feat) + "</b>")
              pred_x_val = x_val[dict_features[feat]]
              x_hover.append(
                  f"Id: <b>{add_line_break(id_i, 40, 160)}</b>"
                  + f"<br /><b>{add_line_break(feat, 40, 160)}</b> <br />"
                  + f"Contribution: {contrib[i]:.4f} <br />Value: "
                  + str(add_line_break(pred_x_val, 40, 160))
              )
  
          lines.append(
              go.Scatter(
                  x=x_i,
                  y=features,
                  mode="lines+markers",
                  showlegend=True,
                  name=f"Id: <b>{index[i]}</b>",
                  hoverinfo="text",
                  hovertext=x_hover,
                  marker={"color": dic_color[i % len(dic_color)]},
              )
          )
  
      fig = go.Figure(data=lines, layout=layout)
      fig.update_yaxes(automargin=True)
      fig.update_xaxes(automargin=True)
  
      if file_name is not None:
          plot(fig, filename=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 17 for calling the SmartPlotter obj's underlying member method code with example usage: obj.plot_line_comparison(index, feature_values, contributions, predictions, dict_features, subtitle, width, height, file_name, auto_open) and returns: fig