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_prediction displays a Plotly scatter or violin plot of predictions in comparison to the target variable.
  This plot represents Trues Values versus Predicted Values.
  
  This plot allows the user to understand the distribution of predictions in comparison to the target variable.
  With the web app, it is possible to select the wrong or correct predictions or a subset of predictions.
  
  Parameters
  ----------
  selection: list (optional)
      Contains list of index, subset of the input DataFrame that we want to plot
  label: integer or string (default -1)
      If the label is of string type, check if it can be changed to integer to select the
      good dataframe object.
  max_points: int (optional, default: 2000)
      maximum number 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)
      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
code: def scatter_plot_prediction(
      self,
      selection=None,
      label=-1,
      max_points=2000,
      width=900,
      height=600,
      file_name=None,
      auto_open=False,
  ):
      """
      scatter_plot_prediction displays a Plotly scatter or violin plot of predictions in comparison to the target variable.
      This plot represents Trues Values versus Predicted Values.
  
      This plot allows the user to understand the distribution of predictions in comparison to the target variable.
      With the web app, it is possible to select the wrong or correct predictions or a subset of predictions.
  
      Parameters
      ----------
      selection: list (optional)
          Contains list of index, subset of the input DataFrame that we want to plot
      label: integer or string (default -1)
          If the label is of string type, check if it can be changed to integer to select the
          good dataframe object.
      max_points: int (optional, default: 2000)
          maximum number 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)
          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
      """
      if self.explainer.y_target is not None:
          # Sampling
          list_ind, addnote = self.explainer.plot._subset_sampling(
              selection, max_points
          )
  
          # Classification Case
          if self.explainer._case == "classification":
              (
                  fig,
                  subtitle,
              ) = self.explainer.plot._prediction_classification_plot(
                  list_ind, label
              )
  
          # Regression Case
          elif self.explainer._case == "regression":
              (
                  fig,
                  subtitle,
              ) = self.explainer.plot._prediction_regression_plot(
                  list_ind
              )
  
          # Add traces, title and template
          title = "True Values Vs Predicted Values"
          if subtitle and addnote:
              title += (
                  "<br><sup>" + subtitle + " - " + addnote + "</sup>"
              )
          elif subtitle:
              title += "<br><sup>" + subtitle + "</sup>"
          else:
              title += "<br><sup>" + addnote + "</sup>"
          dict_t = copy.deepcopy(self._style_dict["dict_title"])
          dict_xaxis = copy.deepcopy(self._style_dict["dict_xaxis"])
          dict_yaxis = copy.deepcopy(self._style_dict["dict_yaxis"])
          dict_t["text"] = title
          dict_xaxis["text"] = truncate_str("True Values", 110)
          dict_yaxis["text"] = "Predicted Values"
  
          fig.update_traces(
              marker={
                  "size": 10,
                  "opacity": 0.8,
                  "line": {"width": 0.8, "color": "white"},
              }
          )
  
          fig.update_layout(
              template="none",
              title=dict_t,
              width=width,
              height=height,
              xaxis_title=dict_xaxis,
              yaxis_title=dict_yaxis,
              hovermode="closest",
          )
  
          fig.update_yaxes(automargin=True)
          fig.update_xaxes(automargin=True)
          if file_name:
              plot(fig, filename=file_name, auto_open=auto_open)
  
      else:
          fig = go.Figure()
          fig.update_layout(
              xaxis={"visible": False},
              yaxis={"visible": False},
              annotations=[
                  {
                      "text": "Provide the y_target argument in the compile() method to display this plot.",
                      "xref": "paper",
                      "yref": "paper",
                      "showarrow": False,
                      "font": {"size": 14},
                  }
              ],
          )
  
      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 32 for calling the SmartPlotter obj's underlying member method code with example usage: obj.scatter_plot_prediction(selection, label, max_points, width, height, file_name, auto_open) and returns: fig