code: def format_data(data):
      """Format data."""
      # Format negative features
      neg_features = np.array(
          [
              [
                  data["features"][x]["effect"],
                  data["features"][x]["value"],
                  data["featureNames"][x],
              ]
              for x in data["features"].keys()
              if data["features"][x]["effect"] < 0
          ]
      )
  
      neg_features = np.array(
          sorted(neg_features, key=lambda x: float(x[0]), reverse=False)
      )
  
      # Format positive features
      pos_features = np.array(
          [
              [
                  data["features"][x]["effect"],
                  data["features"][x]["value"],
                  data["featureNames"][x],
              ]
              for x in data["features"].keys()
              if data["features"][x]["effect"] >= 0
          ]
      )
      pos_features = np.array(
          sorted(pos_features, key=lambda x: float(x[0]), reverse=True)
      )
  
      # Define link function
      if data["link"] == "identity":
  
          def convert_func(x):
              return x
  
      elif data["link"] == "logit":
  
          def convert_func(x):
              return 1 / (1 + np.exp(-x))
  
      else:
          emsg = f"ERROR: Unrecognized link function: {data['link']}"
          raise ValueError(emsg)
  
      # Convert negative feature values to plot values
      neg_val = data["outValue"]
      for i in neg_features:
          val = float(i[0])
          neg_val = neg_val + np.abs(val)
          i[0] = convert_func(neg_val)
      if len(neg_features) > 0:
          total_neg = np.max(neg_features[:, 0].astype(float)) - np.min(
              neg_features[:, 0].astype(float)
          )
      else:
          total_neg = 0
  
      # Convert positive feature values to plot values
      pos_val = data["outValue"]
      for i in pos_features:
          val = float(i[0])
          pos_val = pos_val - np.abs(val)
          i[0] = convert_func(pos_val)
  
      if len(pos_features) > 0:
          total_pos = np.max(pos_features[:, 0].astype(float)) - np.min(
              pos_features[:, 0].astype(float)
          )
      else:
          total_pos = 0
  
      # Convert output value and base value
      data["outValue"] = convert_func(data["outValue"])
      data["baseValue"] = convert_func(data["baseValue"])
  
      return neg_features, total_neg, pos_features, total_pos
  
file_path: shap/shap/plots/_force_matplotlib.py
imports: import matplotlib
  import matplotlib.pyplot
  import numpy
  from matplotlib import lines
  from matplotlib.font_manager import FontProperties
  from matplotlib.patches import PathPatch
  from matplotlib.path import Path
label_desc: Use image node_id 3 for calling a global function with example usage: format_data(data) and returns: neg_features,  total_neg,  pos_features,  total_pos, x, unknown