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: Diplays a Plotly scatter plot or violin plot of two selected features and their combined
  contributions for each of their values.
  This plot allows the user to understand how the different combinations of values of the
  two selected features influence the importance of the two features in the model output.
  A sample is taken if the number of points to be displayed is too large
  Parameters
  ----------
  col1: String or Int
      Name, label name or column number of the first column whose contributions we want to plot
  col2: String or Int
      Name, label name or column number of the second column whose contributions we want to plot
  selection: list (optional)
      Contains list of index, subset of the input DataFrame that we want to plot
  violin_maxf: int (optional, default: 10)
      maximum number modality to plot violin. If the feature specified with col argument
      has more modalities than violin_maxf, a scatter plot will be choose
  max_points: int (optional, default: 2000)
      maximum number of points to plot in contribution plot. if input dataset is bigger than
      max_points, a sample limits the number of points to plot.
      nb: you can also limit the number using 'selection' parameter.
  width : Int (default: 900)
      Plotly figure - layout width
  height : Int (default: 600)
      Plotly figure - layout height
  file_name: string (optional)
      File name to use to save the plotly bar chart. If None the bar chart will not be saved.
  auto_open: Boolean (optional)
      Indicate whether to open the bar plot or not.
  Returns
  -------
  Plotly Figure Object
  Example
  --------
  >>> xpl.plot.interactions_plot(0, 1)
code: def interactions_plot(
      self,
      col1,
      col2,
      selection=None,
      violin_maxf=10,
      max_points=500,
      width=900,
      height=600,
      file_name=None,
      auto_open=False,
  ):
      """
      Diplays a Plotly scatter plot or violin plot of two selected features and their combined
      contributions for each of their values.
      This plot allows the user to understand how the different combinations of values of the
      two selected features influence the importance of the two features in the model output.
      A sample is taken if the number of points to be displayed is too large
      Parameters
      ----------
      col1: String or Int
          Name, label name or column number of the first column whose contributions we want to plot
      col2: String or Int
          Name, label name or column number of the second column whose contributions we want to plot
      selection: list (optional)
          Contains list of index, subset of the input DataFrame that we want to plot
      violin_maxf: int (optional, default: 10)
          maximum number modality to plot violin. If the feature specified with col argument
          has more modalities than violin_maxf, a scatter plot will be choose
      max_points: int (optional, default: 2000)
          maximum number of points to plot in contribution plot. if input dataset is bigger than
          max_points, a sample limits the number of points to plot.
          nb: you can also limit the number using 'selection' parameter.
      width : Int (default: 900)
          Plotly figure - layout width
      height : Int (default: 600)
          Plotly figure - layout height
      file_name: string (optional)
          File name to use to save the plotly bar chart. If None the bar chart will not be saved.
      auto_open: Boolean (optional)
          Indicate whether to open the bar plot or not.
      Returns
      -------
      Plotly Figure Object
      Example
      --------
      >>> xpl.plot.interactions_plot(0, 1)
      """
  
      if not (
          isinstance(col1, (str, int)) or isinstance(col2, (str, int))
      ):
          raise ValueError(
              "parameters col1 and col2 must be string or int."
          )
  
      col_id1 = self.explainer.check_features_name([col1])[0]
      col_name1 = self.explainer.columns_dict[col_id1]
  
      col_id2 = self.explainer.check_features_name([col2])[0]
      col_name2 = self.explainer.columns_dict[col_id2]
  
      col_value_count1 = self.explainer.features_desc[col_name1]
  
      list_ind, addnote = self._select_indices_interactions_plot(
          selection=selection, max_points=max_points
      )
  
      if addnote is not None:
          addnote = add_text(
              [
                  addnote,
                  f"{len(list_ind)} ({int(np.round(100 * len(list_ind) / self.explainer.x_init.shape[0]))}%)",
              ],
              sep="",
          )
  
      # Subset
      if self.explainer.postprocessing_modifications:
          feature_values1 = self.explainer.x_contrib_plot.loc[
              list_ind, col_name1
          ].to_frame()
          feature_values2 = self.explainer.x_contrib_plot.loc[
              list_ind, col_name2
          ].to_frame()
      else:
          feature_values1 = self.explainer.x_init.loc[
              list_ind, col_name1
          ].to_frame()
          feature_values2 = self.explainer.x_init.loc[
              list_ind, col_name2
          ].to_frame()
  
      interaction_values = self.explainer.get_interaction_values(
          selection=list_ind
      )[:, col_id1, col_id2]
      if col_id1 != col_id2:
          interaction_values = interaction_values * 2
  
      # selecting the best plot : Scatter, Violin?
      if col_value_count1 > violin_maxf:
          fig = self._plot_interactions_scatter(
              x_name=col_name1,
              y_name="Shap interaction value",
              col_name=col_name2,
              x_values=feature_values1,
              y_values=pd.DataFrame(
                  interaction_values, index=feature_values1.index
              ),
              col_values=feature_values2,
              col_scale=self._style_dict["interactions_col_scale"],
          )
      else:
          fig = self._plot_interactions_violin(
              x_name=col_name1,
              y_name="Shap interaction value",
              col_name=col_name2,
              x_values=feature_values1,
              y_values=pd.DataFrame(
                  interaction_values, index=feature_values1.index
              ),
              col_values=feature_values2,
              col_scale=self._style_dict["interactions_col_scale"],
          )
  
      self._update_interactions_fig(
          fig=fig,
          col_name1=col_name1,
          col_name2=col_name2,
          addnote=addnote,
          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 23 for calling the SmartPlotter obj's underlying member method code with example usage: obj.interactions_plot(col1, col2, selection, violin_maxf, max_points, width, height, file_name, auto_open) and returns: fig